[DEV][WIP][ICS][GUIDE]Patchrom method to build MIUI from Source - Sony Xperia P, U, Sola, Go

After the Release of ICS for our phones i decided to try building MIUI for our phones
I was able to make a zip but still havent got a booting ROM
Here I Hope to bring out developers to try and help out in developing an MIUI ROM Based on Stock the Procedure is pretty Simple
This also might Help understand what this Project is about
MIcode-Patchrom
To get started with MiCode/patchrom, you'll need to get
familiar with [Git and Repo](http://source.android.com/download/using-repo).
To initialize your local repository using the patchrom trees, use a command like this:
mkdir patchrom
cd patchrom
repo init -u git://github.com/MiCode/patchrom.git -b ics
Then to sync up:
repo sync
once there
We start off like this
STEP 1: Extracting the tools
I've extracted the tools to ~/patchrom, but you can use another directory if you want. I'll call that folder the PatchROM root folder.
STEP 2: Choosing the ROM
The PatchROM docs recommend that we use a stock ICS ROM from the device manufacturer.
So i've taken thebrainfaka's beta build and used it as my Base ROM.
U could follow the same steps
EDIT:
Although i Decided to turn things around after alotta failures so now if ur on the stock rom just type in
Code:
../build/envsetup.sh
when u are in the folder ST25i
then
Code:
../tools/releasetools/ota_target_from_phone -r
STEP 3: Creating the file structure
To port, we need to create a folder inside the PatchROM root directory for our device. I created a folder called 'ST25i' and made a makefile file
You also need to decompile the following APK files and put the resulting folder on the 'ST25i' folder:
/system/framework/android.policy.jar
/system/framework/framework.jar
/system/framework/framework-res.apk
/system/app/SystemUI.apk
/system/framework/services.jar
and the apps defined on the 'local-modified-apps' below
STEP 4: Editing the Makefile
The makefile i made has the following structure:
Code:
#
# Makefile for ST25i
#
# The original zip file, MUST be specified by each product
local-zip-file := ST25i.zip
# The output zip file of MIUI rom, the default is porting_miui.zip if not specified
local-out-zip-file := MIUI_ST25i.zip
# All apps from original ZIP, but has smali files chanded
local-modified-apps := CustomizedSettings MediaProvider
local-modified-jars :=
local-miui-modified-apps := MiuiHome Mms Settings Phone ThemeManager MiuiGallery Music
local-miui-removed-apps := MediaProvider
# All apps need to be removed from original ZIP file
include phoneapps.mk
# To include the local targets before and after zip the final ZIP file,
# and the local-targets should:
# (1) be defined after including porting.mk if using any global variable(see porting.mk)
# (2) the name should be leaded with local- to prevent any conflict with global targets
local-pre-zip := local-zip-misc
local-after-zip:= local-test
# The local targets after the zip file is generated, could include 'zip2sd' to
# deliver the zip file to phone, or to customize other actions
include $(PORT_BUILD)/porting.mk
# To define any local-target
local-zip-misc:
@echo Replace build.prop
cp other/build-ST25i.prop $(ZIP_DIR)/system/build.prop
rm $(ZIP_DIR)/system/vendor/overlay -rf
rm $(ZIP_DIR)/system/etc/customization/content/com/sonyericsson/wallpaperpicker/wallpapers -rf
local-test:
echo "an example action"
Code:
local-phone-apps = AccessoryKeyDispatcher \
AdobeFlashPlayer \
ApplicationsProvider \
AudioEffectService \
Bluetooth \
bootinfo \
CameraExtensionPermission \
CdfInfoAccessor \
CertInstaller \
CredentialManagerService \
DefaultCapabilities \
DefaultContainerService \
enhancedusbux \
ES_File_Explorer \
FaceLock \
GenericApplicationInstaller \
Initial-boot-setup \
livewallpaperearth \
InfiniteView \
MediaProvider \
MemcardTransportService \
Nfc \
PackageInstaller \
qcsemcservice \
Radio3 \
SemcCamera3D \
QuickPanelSettings \
SecWallpaperChooser \
SemcAlbum \
SemcAutoPowerOff \
SemcCameraUI \
SemcClock \
ServiceMenu \
SoundEnhancement \
usb-mtp-backup-transport \
usb-mtp-marlin-wrapper \
usb-mtp-update-wrapper \
usb-mtp-vendor-extension-service \
usbotg \
UsbTransportService \
UserDictionaryProvider \
UxpNxtLockScreen \
WapiCustomization \
WapPush \
WeatherWidget \
Youtube
Now Phoneapps.mk which i included in the makefile refers to all phone apps that i dont require
I'm still not sure regarding this but this what i made it so far
STEP 5: Apply MIUI Changes
To apply the MIUI changes on the choosen ROM, type those commands in the root of PatchROM:
Code:
source build/envsetup.sh
cd ST25i # CHANGE THIS LINE TO MATCH THE FOLDER YOU CREATED IN STEP 3
make
Now it should decompile the ROM and merge the ROM's smali files with the MIUI files, and create an ZIP file with the MIUI rom.
Github Sources for Xperia U build directory
Here!
These files should be in the folder u named as ST25i
u may use "git clone " and get all the files into ur local directory "ST25i"
Please Note in my github i've provided Files SPECIFICALLY FOR XPERIA U

Following everthing U've done so far
Now u maybe able to make ur build
while in the "patchrom" directory type in
Code:
$source ./build/envsetup.sh
$cd ST25i
$make
then go to folder/view options and check "show hidden files"
Now u will see a folder named ".build"
Enter that folder u will find a zip named MIUI_ST25i.zip
Which is Your MIUI ROM
So far I havent had success in getting it to boot,
So a humble request to All Devs to help out with this

Thanks for support Xperia U
Regards.

Hi Friends,
Just stumbled upon this thread while I was searching for something else. I recently managed to successfully port MIUI patchrom for my device Samsung Galaxy R running ICS 4.0.4.
The patchrom is for ICS 4.0.1 - 4.0.3, so if you running 4.0.4, it will be a little tougher.
But seeing the OP, I see you got something missing after build/envsetup.sh you need to run "make firstpatch" for the first time. That patches your framework, services and policy to work with MIUI. Then you'll get a hell lot of reject smali code files that you need to fix by hand. Then when you "make fullota" or "make zipfile" it will work. You may also need to patch your kernel init script in case your framework is too large for apktool to build and needs to be divided into two, like in our case.
I hope this helps. I was quoting the standard MiCode patchrom way of porting new devices. Please ignore if you are following some other setup.

parajsinghal said:
Hi Friends,
Just stumbled upon this thread while I was searching for something else. I recently managed to successfully port MIUI patchrom for my device Samsung Galaxy R running ICS 4.0.4.
The patchrom is for ICS 4.0.1 - 4.0.3, so if you running 4.0.4, it will be a little tougher.
But seeing the OP, I see you got something missing after build/envsetup.sh you need to run "make firstpatch" for the first time. That patches your framework, services and policy to work with MIUI. Then you'll get a hell lot of reject smali code files that you need to fix by hand. Then when you "make fullota" or "make zipfile" it will work. You may also need to patch your kernel init script in case your framework is too large for apktool to build and needs to be divided into two, like in our case.
I hope this helps. I was quoting the standard MiCode patchrom way of porting new devices. Please ignore if you are following some other setup.
Click to expand...
Click to collapse
Ah i'm following a different setup mate,for me the first problem to be tackled is compiling framework-res.apk,i
Even without changes I'm able to recompile but the darn thing wont work,
I have reports of similair errors in compiling framework-res
Once i get that sorted out i should be able to move forward...
oh and i already have compiled framework,services and policy with miui changes btw,
I'm pretty sure its the framework-res.apk which is giving me errors,
Some dudes in Sola also reported the same...
Hopefully when i figure out why my compiled framework doesnt boot i should get stuff moving..

bharat_goku said:
Ah i'm following a different setup mate,for me the first problem to be tackled is compiling framework-res.apk,i
Even without changes I'm able to recompile but the darn thing wont work,
I have reports of similair errors in compiling framework-res
Once i get that sorted out i should be able to move forward...
oh and i already have compiled framework,services and policy with miui changes btw,
I'm pretty sure its the framework-res.apk which is giving me errors,
Some dudes in Sola also reported the same...
Hopefully when i figure out why my compiled framework doesnt boot i should get stuff moving..
Click to expand...
Click to collapse
Why are you completetly compiling and not only drag/drop modified files using 7zip. Or did i understand something wrong.....

thebrainkafka said:
Why are you completetly compiling and not only drag/drop modified files using 7zip. Or did i understand something wrong.....
Click to expand...
Click to collapse
I have smali files too which can't be added by 7zip
Sent from my ST25i using xda premium

Ok now i decided to restart the building procedure all over again,
Too many errors in my build log so gimme a little while before i update my github sources...

To make MIUI working you must edit ramdisk in kernel.

Related

Starting with cyanogen mod for nexus one

This is only for system files, the instructions for kernel making will come as soon as i get some time.
Credits (these people helped me build form source the first time and created some awesome wiki at wiki.cyanogenmod.com)
Cyanogen
Maxisma
Chris Soyars
Kmobs
thedudesandroid
rikupw
pershoot
bcrook
and many more if i have missed just tell me
If u want to learn building from source, cyanogenmod is the best place to start with. What u need is UBUNTU/DEBIAN , i would recommend start with ubuntu as i find it the best to start with it. U should have atleast 20gb of storage in ubuntu. U can use a virtual machine or full OS anything which suits u.
To start with nexus one
Making ur computer ready to build
1. sudo aptitude install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
2. If u have 64 bit version add this (only for 64bit)
sudo aptitude install ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
3. cd ~
4. mkdir bin
5. cd bin
6. echo $PATH
Here i would recommend editing ur .baschrc in your home directory. It is a hidden file so u have to edit it in terminal using command gedit .baschrc
and adding a line to the last line export PATH=$PATH:~/bin
Now u have to setup repo
1. curl http://android.git.kernel.org/repo >~/bin/repo
2. chmod +x ~/bin/repo
This is for obtaining the source
1. Open Terminal
2. cd ~
3. mkdir cm-build
4. repo init -u git://github.com/cyanogen/android.git -b eclair
5. repo sync
Wait for the repo to sync as it is really huge around 2.5 gb
After the sync has completed u have to create the environment
1. cd cm-build
2. . build/envsetup.sh
Builiding ADB - Do it only if u havent already built it. Most probably u havent
make -j3 adb
now add the path of adb directory of adb like u did for bin. adb will be in the out folder in folder cm-build
Now configure your build
select the build u want to make, list using this command
1. sed -n -e "s/^add_lunch_combo//gp" vendor/*/vendorsetup.sh
2. lunch cyanogen_passion-eng
Get properitery files from ur devices- dont skip this step. U need to have adb setup. And if u are unable to get the files ur build will not complete. i will upload a folder with properitery files today with instructions how to place them so if u r unable to get them u can use those files
1. cd ~/cm-build/vendor/google/passion
2. ./extract-files.sh
Now the final step building
make -j3
The -j flag specifies how many threads the compiler should use. Rule is # of processors+1
its gonna take time for the first time u build so just relax somewhere, go eating, watch Movies, use google video
all the files will be in
~/android-cm/out/target/product/passion
u can use fastboot to flash those files and test the build
If u have any problems while building just let me know with the error where it as stopped. using the command make-clean solves most issues but it will make u build from scratch again thus building will take the same time as it took while building the first time as it clears all the prebuilt files
If u find anything to correct in this wiki let me know i will do it
More to come
1. Kernel compiling
2. making update.zip
Thanks for the guide, man.
BTW, I noticed you used java 6 in your instructions, which is good, because the official Android source (not cyanogen's) requires Java 5, which is outdated and conflicts with the version required for my ROM kitchen.
JAVA 5 is more compatible coz java 6 doesnt support overriding, anyways if anyone has problem of overriding commands use java5
sudo aptitude install sun-java5-jdk
and yes obviously java 6 is better but java5 is best for compiling with android, its just ur wish what suits u best
UPDATE: built this time using java6 and it built fine. If u r using the android repo instead of CM use java5 . If u have both installed u can switch versions using
sudo update-alternatives --config java
select any version u want
i will be updating the post with kernel making and bcm4329.ko, just didnt get time
charnsingh_online said:
JAVA 5 is more compatible coz java 6 doesnt support overriding,
Click to expand...
Click to collapse
You might be mistaken about overriding.
Some people had problems with override annonation with java6, if u have those problems java5 is best coz repairing and finding errors i find it time consuming so better switch versions.
charnsingh_online said:
Some people had problems with override annonation with java6, if u have those problems java5 is best coz repairing and finding errors i find it time consuming so better switch versions.
Click to expand...
Click to collapse
You can still install Java 5 and 6 concurrently on your LINUX box. Just set the JAVA_HOME and PATH environment variables to point to the Java version you want to use for a particular application.
On my box I make Java 5 the default, and when I want to use Java 6 (e.g. when cooking) I just source a file with the new variables set.
yeah i gave the instructions how to shift java versions, i too have 2 versions of java installed
charnsingh_online said:
yeah i gave the instructions how to shift java versions, i too have 2 versions of java installed
Click to expand...
Click to collapse
Good work! As soon as I have some spare time I'll try out your instructions and possibly help you out with the Nexus One video recording issue.
THX BRO, JUST pm me or reply me on twitter when u get time
Question on workspace location
I have a question when it comes to WHERE you put your workspace to do development. The instructions refer to your home directory. I would prefer to put EVERYTHING within a sub-directory (or any directory for that matter) instead of all these directories being created off my home directory (I like to keep it clean). I followed your instructions and Google's instructions and it creates: bin, bionic, bootable, build, cm-build, cts, dalvik, development, external, frameworks, hardware, kernel-msm, Makefile, packages, prebuild, sdk, system, and vendor.
So, can I undo what I did and re-create my workspace in a different location? Or, is it specific to the home (~) directory so the scripts work?
BTW, how do I undo the creation of these directories and access to the source repository? Just a simple "delete" of the directories and files?
Sweet guide! Will check this out soon!

[All In One Guide for Dummies] Porting ROMs/Building CM7 from Source/Themes |80% Done

Here you have it people , I may be wrong at some places so please excuse me
Requirements :
winzip
any file explorer on your desktop
2 ROMs ( one of X10 and other )
Suggestions :
Use ROMs from Phones like NexusOne , HTC Desire
all phones with QSD8250 and Adreno 200
Method:
Just do these changes to the files and have a Port which boots up
Delete :
/data folder
boot.img
/system/etc/firmware
/system/etc/init.d
Copy & Paste :
in /system/bin -
akmd2
am
bmgr
chargemon
charger
fix_permissions
hci_qcomm_init
hci_attach
ime
input
monkey
pm
port-bridge
qumxd
rild
updatemiscta
wlanmac
wlantool
ramdisk.tar/.gz
/system/etc :
replace all files in -
bluetooth
dhcpcd
wifi
firmware
copy the files -
apns-conf.xml
dbus.conf
DualMicControl
gps.conf
hosts
init* files
media-profiles.xml
resolv.conf
sensors.conf
sysctl.conf
vold.fstab
/system/lib folder :
delete and replace all files in:
/system/lib/modules
/system/lib/hw
copy the following files
in /system/lib/egl :
All EXCEPT libGLES_android.so
copy & replace these files :
libauth.so
libcm.so
libdiag.so
libdbus.so
libdss.so
libdsm.so
libgsl.so
libgstk_exp.so
libmiscta.so
libmmgsdilib.so
libmmipl.so
libmmjpeg.so
libnv.so
liboem_rapi.so
liboemcamera.so
liboncrpc.so
libpbmlib.so
libqmi.so
libqueue.so
libril.so
libril-qc-1.so
libuim.so
libwms.so
libwmsts.so
/system/usr/keychars -
es209ra_keypad.kcm
and delete the original file (example : passion_keypad.kcm OR bravo_keypad.kcm)
/system/usr/keylayout -
es209ra*.kl
do the same as with.kcm
Replace :-
Build.prop
META-INF folder
Cautions :-
Use the same version of android to port
You will need to change the build.prop to whatever you desire
You may need to edit the update-script
Porting gets over here !!!!!
WAIT I'll Complete it later
Many People want to know this right ?
Bro , Dude , Buddy , friend , mate WHICH FILES ARE FOR WHAT ??
what does akmd2 do ? what is it for ????
Here , I will try to provide you as many answers as I can :-
# Prebuilt kl keymaps
/system/usr/keylayout/es209ra_keypad.kl
/system/usr/keylayout/es209ra_handset.kl
/system/usr/keychars/es209ra_keypad.kcm.bin
## RIL related stuff [Responsible For GSM/DATA and Sim card]
/system/lib/libril.so
/system/bin/port-bridge
/system/bin/qmuxd
/system/lib/libauth.so
/system/lib/libcm.so
/system/lib/libdiag.so
/system/lib/libdll.so
/system/lib/libdsm.so
/system/lib/libdss.so
/system/lib/libgsdi_exp.so
/system/lib/libgstk_exp.so
/system/lib/libmmgsdilib.so
/system/lib/libnv.so
/system/lib/liboem_rapi.so
/system/lib/liboncrpc.so
/system/lib/libpbmlib.so
/system/lib/libqmi.so
/system/lib/libqueue.so
/system/lib/libuim.so
/system/lib/libril-qc-1.so
/system/lib/libwms.so
/system/lib/libwmsts.so
## Camera proprietaries
/system/lib/liboemcamera.so
/system/lib/libmmjpeg.so
/system/lib/libmmipl.so
/system/lib/libcamera.so
/system/lib/libopencore_common.so
## FIRMWARE
/system/etc/firmware/yamato_pfp.fw
/system/etc/firmware/yamato_pm4.fw
/system/etc/firmware/camfirm.bin
## ATHEROS WIFI [ WIFI modules for X10 ]
/system/lib/modules/athwlan.bin.z77
/system/lib/modules/data.patch.hw2_0.bin
/system/bin/wlan_mac
/system/bin/wlan_tool
## BT proprietary [ Bluetooth for X10 ]
/system/bin/hci_qcomm_init
/system/bin/hciattach
## Adreno 200 files [ Responsible for display i.e. the GPU ]
/system/lib/libgsl.so
/system/lib/egl/libGLESv1_CM_adreno200.so
/system/lib/egl/libq3dtools_adreno200.so
/system/lib/egl/libEGL_adreno200.so
/system/lib/egl/libGLESv2_adreno200.so
## Other libraries and proprietary binaries
/system/etc/vold.fstab [ SD Card ]
/system/etc/sensors.conf [Proximity sensors , etc]
/system/bin/akmd2
#offline charger
/system/bin/chargemon
/system/bin/updatemiscta
/system/lib/libmiscta.so
#hw [The lights between the HOME , Menu and back button ]
/system/lib/hw/copybit.qsd8k.so
/system/lib/hw/sensors.default.so
HOW TO MAKE THEMES
There are 2 types of themes you can make :-
1.Involving systemUI.apk and framework-res.apk
2.Involving the T-mobile Theme engine
I will begin with LEVEL (1)
There are two ways of doing this as well
1.Classic Way
2.The spaarc's cheap way (I use this one )
CLASSIC WAY
Requirements :-
1.A cool head
2.Apk Manager 4.4 (OR any APK editor , etc )
3.Original Framework-res.apk and SystemUI.apk
4.Themed Framework-res.apk and SystemUI.apk
OR
4.Many .PNG Images , In order to theme
Method :-
1.Use apk manager to decompile the original AND Themed apk's(i.e If you have a themed one)
2.ONLY Replace files found in /res/drawable-hdpi folder
3.ReCompile
4.Just replace Using RootExplorer or make a update.zip
Spaarc's Cheap Way
This is top secret , but i will tell it you
Requirements :-
1.Computer
2.7-zip
3.Original Framework-res.apk and SystemUI.apk
4.Themed Framework-res.apk and SystemUI.apk
OR
4.Many .PNG Images , In order to theme
Method :-
1.Use 7-zip to extract the apk
2.Replace files
3.Repack as zip using 7-zip again
4.Rename to ".apk"
5.Replace and Enjoy
T-MOBILE THEME CHOOSER
Follow this AWESOME guide
I don't have the time or patience of rewritting it in my cheeky tongue
Here , this completes your themeing guide
If you have any questions just Drop me a PM
HOW TO COMPILE CM7 ROMS FROM SOURCE
I have written this guide only for linux Users
Bibliography -
1.source.android.com
2.wiki.cyanogenmod.com
The guide starts here :-
Install the ADB
Install the Android SDK.
2.Install the Build Packages
Install using the package manager of your choice:
For 32-bit & 64-bit systems:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
For 64-bit only systems:
sudo 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:
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
This will get you all the resources you need to build your CyanogenMod ROM
3.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
4.Install the Repository
Enter the following to download make executable the "repo" binary:
curl https://github.com/spaarc/tools_repo/repo > ~/bin/repo "OR" curl https://github.com/spaarc/tools_repo/blob/master/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
repo sync -j16
5.Copy proprietary files
NOTE: This only needs done the first time you build.
You will need to have a Xperia X10 with a working copy of CyanogenMod install and ADB working on the computer. This script will copy the proprietary files from the device.
Connect the device to the computer and ensure that ADB is working properly.
cd ~/android/system/device/SEMC/es209ra/
./extract-files.sh
NOTE: If some hardware isn't working, like camcorder or FM radio, you will need to find the updated prop blobs.
6.Download RomManager
NOTE: This only needs to be done when an update to RomManager is released. If you are-up-to date, you may skip to Building CyanogenMod.
Download RomManager which is needed by the build:
~/android/system/vendor/cyanogen/get-rommanager
7.Building CyanogenMod
Check for updates
First, check for updates in the source:
cd ~/android/system/
repo sync
Configure Build & Compile
Now, the environment must be configured to build and the ROM compiled, from code, for the Xperia X10
. build/envsetup.sh && brunch es209ra
Install
Copy your .zip file from ~/android/system/out/target/product/es209ra/update.cm-XXXXX-signed.zip to the root of the SD card.
Optional: Download Google Apps for CyanogenMod 7 and place it on the root of the SD card.
Flash both of these .zip files from recovery.
reserved 4
reserved last
Awesome my friend, keep it up, good to see another dude, which are trying to help our X10 community .
Thnx a lot Spaarc bro.... u r gr8 coz u help
Sent from my X10i using XDA App
thanks sparc that will help people like me who wants to develop and play with android and with the xperia
That is nothing ,
The first post is incomplete
I also have to write how to compile Aosp ROM s
Which files are for what , which you r porting
I also have to write how to code those sources which u can see at github ...
There is a lot , how to make themes ...
sent from my Android powered smart phone
spaarc said:
That is nothing ,
The first post is incomplete
I also have to write how to compile Aosp ROM s
Which files are for what , which you r porting
I also have to write how to code those sources which u can see at github ...
There is a lot , how to make themes ...
sent from my Android powered smart phone
Click to expand...
Click to collapse
Why dont you type it up on notepad or ms word so you dont have to keep stopping and people than going it is only half complete and crap like that. If you type it all up in notepad then you can just copy/paste here and then it will all me done.
Just saying what I would do and just trying to help
Sent from my X10i using xda premium
I don't have time to do it that's why ...
I'll complete it in this week
I don't care what people say
sent from my Android powered smart phone
wow..nice tutorial man!!
thanx!
Main part of the guide is over
approx 2/3 left
Really really exhausted , TC and bring me new ROMS
Thanks can u do like a guide of porting roms from the phones with different gpu/cpu?
Paji tussi great hoo!!
Sent from my X10i using xda premium
#offline charger
/system/bin/chargemon
/system/bin/updatemiscta
/system/lib/libmiscta.so
Click to expand...
Click to collapse
is that all for offline charging?
i am working on integrating offline charger in main kernel ramdisk... so that it will be independent of all things in /system
If I can't do it how could I teach you ?
It is next to impossible
Bit still editing the init.rc in ramdisk should do the trick
sent from my Android powered smart phone
spaarc said:
If I can't do it how could I teach you ?
It is next to impossible
Bit still editing the init.rc in ramdisk should do the trick
sent from my Android powered smart phone
Click to expand...
Click to collapse
that and hex editing the files involved
Mate i need help have done this method with x10 2.3.3 and arc 2.3.4 and only copied the files u have said and i have UB with DK v5 the phone just reboots and reboots while on DK logo...
Shouldn't their be files from permissions folder?
sahibunlimited said:
Mate i need help have done this method with x10 2.3.3 and arc 2.3.4 and only copied the files u have said and i have UB with DK v5 the phone just reboots and reboots while on DK logo...
Shouldn't their be files from permissions folder?
Click to expand...
Click to collapse
No nothing more ,
Did you copy the ramdisk ?
Send me a logcat
sent from my Android powered smart phone

Help with error

Hi everyone,
I have started developing my own MIUI ROM with patchrom. Everything went OK, but when I execute the make workspace function, an error message appears and Google doesn't help me with it.
It seems like it's trying to unzip a file that doesn't exists in the stockrom.zip file. I think that I have to modify a file, but I don't find which one it is.
Does anyone have an idea?
This is a fragment from console:
Code:
[email protected]:~/MiCode/patchrom/m7ul$ make workspace
>>> Install framework resources for apktool...
install framework-miui-res.apk
/home/jose/MiCode/patchrom/tools/apktool --quiet if /home/jose/MiCode/patchrom/miui/XHDPI/system/framework/framework-miui-res.apk
/home/jose/MiCode/patchrom/tools/apktool --quiet if /home/jose/MiCode/patchrom/miui/XHDPI/system/framework/framework-res.apk miui
unzip >/dev/null stockrom.zip "system/framework/*.apk" -d out
install out/system/framework/framework-res.apk
<<< install framework resources completed!
unzip >/dev/null stockrom.zip system/framework/services.jar -d out
/home/jose/MiCode/patchrom/tools/apktool --quiet d -f out/system/framework/services.jar services.jar.out
unzip >/dev/null stockrom.zip system/framework/android.policy.jar -d out
/home/jose/MiCode/patchrom/tools/apktool --quiet d -f out/system/framework/android.policy.jar android.policy.jar.out
unzip >/dev/null stockrom.zip system/framework/framework.jar -d out
/home/jose/MiCode/patchrom/tools/apktool --quiet d -f out/system/framework/framework.jar framework.jar.out
unzip >/dev/null stockrom.zip system/framework/framework2.jar -d out
caution: filename not matched: system/framework/framework2.jar
make: *** [framework2.jar.out] Error 11
¡Thanx a lot!
Been trying to get PatchRom to work myself. What a nightmare. I asked over on the offical miui forums and got this reply. My question is first followed by the reply. Perhaps you can make sense of it.
my question:
Thank you very much for this guide! I am not even close to a developer but with much luck I hope to port the latest MIUI to the Samsung Skyrocket, SGH-i727.
If I want to use CM 10.2 as a BASE ROM, can I still use the CM 10.1 Template?
Running Make Workspace gave me an Error 11 for Framework_Ext which is not found and I am unsure where that file should come from. Base ROM? Or take it from a current MIUI ROM?
reply:
You can only use 4.0.4 - 4.2.2 as a MIUI base, it doesn't support 10.2 yet
A lot of the time you can find a pre-existing CM10.1 base for a port that has proper frameworks you can use for Patch, there are a few roads to take when porting this rom and you do not have to use patch to do it.
If you can find a MIUI base that will boot on your phone but the resolution is messed up you can use patch sources to fix the resolution; the internal code doesn't change a lot in between versions just the APK code which is called via generic injector flags

[GIT][REPO][WIP][MEGA GUIDE] How to create your first CM based ROM

How to create your first CM based ROM ​
Introduction​
In this mega thread guys i will show you basically how to create your own custom CM based ROM, i will take CM in consideration because it is the most used here, but the native sources could be from Omni, or to be based on AOSP. But be aware that not all the things said here will be able to be applied to the ROM because some CM things may not be present in other ROM sources. So before jumping to the guides make sure to check out the first part of the thread from the Index.
Usually there are 4 kind of ROM developers:
Those who Create ROMs
Those who port a created ROM for an other device (device which is not supported officially) by adapting kernel sources, propietary files and vendors....
Those who maintain a ROM for a specific device which is not officially supported but the device sources in use are already prepared by an other developer in order to succeed the compilation process
Those who maintain a ROM for a device that is officially supported by the team or organization but the user also has the goal to help the users and know what he is publishing on the forum
We all know that the Bosses of all are Cyanogenmod, OmniROM and so on and after them there are the secondary ROMs which can be: PAC-MAN,Slim,AICP etc... Which they are all based on an already ROM sources (Could be CM or AOSP for example).
So why they can and you not?
That's because your are thinking from a different perspective.
Let me show you:
For sure you are thinking that "Oh my god there is too much coding for me i can't do all these stuff alone"
Exactly you can't do all these stuff alone, for sure you will need at least one more person to work on it but belive me i was also thinking in the same way but looking here and there i learned how to do many things that for example 2 years ago was something unknown for me coming from a different planet.Trust here i will explain you all you need to know about how to create a custom based ROM or at least show you the basics and then learn for your own.(Not necessary an organization for many devices but a small one just to get familiar and to help you starting from there)
So in this guide i will not show you how to compile a new ROM because i assume that you already know that, instead i will show all the common things that can be changed and even also added in the custom ROM sources by eliminating also the CM or the native ROM name from you're taking the sources as much as possible by including your ROM name instead and also showing you strategies which may help you.
Note.
When you fork the repos make sure to always work on the cm-12.1 branch because some changes which we will gonna make in the guide may not exists in cm-12.
For the fact that the guide will be very big, if you will need help, just write it on the thread but in this way:
Make sure that the post title start in this way:
Section of the thread: Settings, Repo part ....
Part of the section (If we talking about the CM Removable part in Settings for example)
Requirements​
Knowledge and experience in compiling ROMs
Github knowledge (Usually you should know this if you compiled a ROM for a device)
Basic knowledge about XML, Java, C (At least know how to work on it not NOOBS on this OK?)
Good computer running Ubuntu (14.04/14.10/15.04/15.10) or a custom Distro based on the specified ones
High quantity of storage for all the file which you will gonna use.
SmartGit which it will help you very much
Index​
Disclaimer and ROM specifications
Environment
Environment Setup
Linux Distribution Part
SmartGit Part
Repo Part
Android Build part
Extra features to be added to the Android Build files
Android Venodr files
Extra features to be added to the Android Vendor files
Settings && Packages part
Extra Features
*******************************************WIP**********************************************
For the fact that the Guide will be very long and it will take some time to complete it all,so please be patient
In the main time will leave here the staus for every part of the guide:
1- Introduction (First post) (Completed! )
2- Linux Distribution Part (Completed!)
3- Environment Setup Part (Completed!)
2- SmartGit Part (Completed! )
3- Repo part (Needs revisions )
4- android_build (Needs revisions )
5- Packages (Working on it!)
6- vendor (Needs revisions )
7- Extra features (Working on it )
8- ROM Description Part (Completed! )
Repo Part​
Ok so let's begin with the Repo part.
In order to have multiple Projects (I mean repo) you need to create an Organization in Github:
{
"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"
}
Now just follow the Github instructions and you should now have this screen:
Now before doing something you need to think and choose what repo to fork and what repo to create manually.
Remember that i will not help you with the Repo created manually those are created by you and only you know what to include there.
By default the repo which need to be forked first are these:
platform_mainfest
android_vendor_files
These usually should be always present in your Github organization, so i recommend you at the begining to fork these repo from Cyanogenmod if you want that your ROM should be based on CM.
So go and fork the these repositories and then go back to your ROM Project.
For the platform_manifest you can fork it here: https://github.com/SlimRoms/platform_manifest/tree/lp5.1
(We will modify it later)
Remember that when you fork the repositories to fork them in your Organization and not in your Github profile.
You should have this screen:
Now you need to think about what Apps or things you are gonna change i mean, there are plenty of things that you can modify before the compilation process like Java files, create new Preference headers in Settings, modify the framework and so go on....
Once you choosed what repo to include in your Organization then you can start to modify your platform manifest.
But what is platform manifest actually?
Platform manifest is that repo that include a file called default.xml which includes all the Projects that should be fetched by the organization. And represent the most important part of a ROM Project followed after by the android_vendor_files.
Once you cloned platform manifest
Go and open the default.xml file.
So let's the modifications begin!
As you can see the default.xml is composed entirely by these sort of strings:
Code:
<project path="android" name="XOSP/platform_manifest" remote="github" revision="lollipop" />
(For example)
So let me explain you what is this:
project path=means the path used from where the files will be stored in your ROM folder
name: reffer to the path used in Github like https://github.com/CyanogenMod/.....
remote=The Origin of the files (Sort of) it can also be bitbucket or Sourceforge but mainly Github is used always
revision= The branch that you want to checkout
So now you know how the default .xml works go and add your repo that should be fetched!
Tip!
Because the default.xml includes all the projects to be fetched, some of them are not required in most of the cases so some strings can be deleted:
Code:
<project path="device/generic/mini-emulator-arm64" name="device/generic/mini-emulator-arm64" groups="pdk" remote="aosp" />
<project path="device/generic/mini-emulator-armv7-a-neon" name="device/generic/mini-emulator-armv7-a-neon" groups="pdk" remote="aosp" />
<project path="device/generic/mini-emulator-mips" name="device/generic/mini-emulator-mips" groups="pdk" remote="aosp" />
<project path="device/generic/mini-emulator-x86" name="device/generic/mini-emulator-x86" groups="pdk" remote="aosp" />
<project path="device/generic/mini-emulator-x86_64" name="device/generic/mini-emulator-x86_64" groups="pdk" remote="aosp" />
<project path="hardware/intel/audio_media" name="platform/hardware/intel/audio_media" groups="intel" remote="aosp" />
<project path="hardware/intel/bootstub" name="platform/hardware/intel/bootstub" groups="intel" remote="aosp" />
<project path="hardware/intel/common/bd_prov" name="platform/hardware/intel/common/bd_prov" groups="intel" remote="aosp" />
<project path="hardware/intel/common/libmix" name="platform/hardware/intel/common/libmix" groups="intel" remote="aosp" />
<project path="hardware/intel/common/libstagefrighthw" name="platform/hardware/intel/common/libstagefrighthw" groups="intel" remote="aosp" />
<project path="hardware/intel/common/libva" name="platform/hardware/intel/common/libva" groups="intel" remote="aosp" />
<project path="hardware/intel/common/libwsbm" name="platform/hardware/intel/common/libwsbm" groups="intel" remote="aosp" />
<project path="hardware/intel/common/omx-components" name="platform/hardware/intel/common/omx-components" groups="intel" remote="aosp" />
<project path="hardware/intel/common/utils" name="platform/hardware/intel/common/utils" groups="intel" remote="aosp" />
<project path="hardware/intel/common/wrs_omxil_core" name="platform/hardware/intel/common/wrs_omxil_core" groups="intel" remote="aosp" />
<project path="hardware/intel/img/hwcomposer" name="platform/hardware/intel/img/hwcomposer" groups="intel" remote="aosp" />
<project path="hardware/intel/img/libdrm" name="platform/hardware/intel/img/libdrm" groups="intel" remote="aosp" />
<project path="hardware/intel/img/psb_headers" name="platform/hardware/intel/img/psb_headers" groups="intel" remote="aosp" />
<project path="hardware/intel/img/psb_video" name="platform/hardware/intel/img/psb_video" groups="intel" remote="aosp" />
<project path="hardware/nvidia/audio" name="CyanogenMod/android_hardware_nvidia_audio" groups="nvidia_audio" />
<project path="hardware/nvidia/tegra124" name="CyanogenMod/android_hardware_nvidia_tegra124" groups="tegra124" />
Usually are these, so now when you will make repo sync to your ROM path those projects won't be fetched by the manifest.
Don't forget to commit the changes made to default.xml with SmartGit (Check this post about how to configure it
More tips about platform_manifest:
If you want to simpify the work for the other users who will want to build your ROM (If they are new comers) you can use this script written originally by the Resurrection Team and then adapted by me:
Code:
#!/bin/bash
#Based on the original one from Resurrection Remix
clear
echo ____ ___________ ___________________ __________ __ __
echo \ \/ /\_____ \ / _____/\______ \ \______ \_______ ____ |__| ____ _____/ |_
echo \ / / | \ \_____ \ | ___/ | ___/\_ __ \/ _ \ | |/ __ \_/ ___\ __\
echo / \ / | \/ \ | | | | | | \( <_> ) | \ ___/\ \___| |
echo /___/\ \\_______ /_______ / |____| |____| |__| \____/\__| |\___ >\___ >__|
echo \_/ \/ \/ \______| \/ \/
echo Installing Dependencies in 5 Seconds...
sleep 1
echo Installing Dependencies in 4 Seconds...
sleep 1
echo Installing Dependencies in 3 Seconds...
sleep 1
echo Installing Dependencies in 2 Seconds...
sleep 1
echo Installing Dependencies in 1 Seconds...
sleep 1
echo Insert your User Password
sudo apt-get update
sudo apt-get install openjdk-7-jdk
y
sudo apt-get update && 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 lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib
y
clear
echo Dependencies have been installed!
sleep 4
clear
echo Installing REPO in 5 Seconds...
sleep 1
echo Installing REPO in 4 Seconds...
sleep 1
echo Installing REPO in 3 Seconds...
sleep 1
echo Installing REPO in 2 Seconds...
sleep 1
echo Installing REPO in 1 Seconds...
sleep 1
mkdir ~/bin
PATH=~/bin:$PATH
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
clear
echo REPO has been Downloaded!
sleep 4
clear
cd ..
mkdir XOSP
echo Creating and Initializing XOSP Source at $XOSPpath in 5...
sleep 1
echo Creating and Initializing XOSP Source at $XOSPpath in 4...
sleep 1
echo Creating and Initializing XOSP Source at $XOSPpath in 3...
sleep 1
echo Creating and Initializing XOSP Source at $XOSPpath in 2...
sleep 1
echo Creating and Initializing XOSP Source at $XOSPpath in 1...
sleep 1
cd XOSP
repo init -u https://github.com/XOSP-Project/platform_manifest.git -b lollipop
clear
echo XOSP Source Code has been initialized!
sleep 4
clear
echo Enter 1 to repo sync now, anything else to do it later
read ch
if [ $ch -eq 1 ] ; then
echo Enter number of jobs to repo sync with. If you\'re not sure, enter 4
read jobs
echo Syncing/Downloading in 5 seconds...
sleep 1
echo Syncing/Downloading in 4 seconds...
sleep 1
echo Syncing/Downloading in 3 Seconds...
sleep 1
echo Syncing/Downloading in 2 Seconds...
sleep 1
echo Syncing/Downloading in 1 Seconds...
repo sync -j$jobs
clear
echo Source code has been Set-Up Succesfully.
else
echo repo has been initialized in $XOSPpath
echo To sync the source, cd to $XOSPpath and run the following command
echo "repo sync"
fi
Just change the XOSP name with your ROM name in all the cases (Just make CTRL F and write XOSP, it will find all the names)
Save it as .sh file, give it a name and then make the commit.
To run it on the computer just open a terminal window and write ./filename.sh
Once you done all these things it's time to repo init your ROM path:
If you done the script then the commands will be less:
Code:
git clone https://github.com/Your Project/platform_manifest.git
cd ~/platform_manifest
./scriptname.sh
Now just sit and relax because it will take a while..
Repo-synched, your ROM path should look like this:
If you made some mistakes into the default.xml files please write it in the Thread.
If it's all good now your brain maybe is gonna to explode because you don't know what are those folders but you don't even to know all these folders, why?
Because is not necessary.
Usually folders like external, developers, bootable are not modified only but the main source which usually is CM or of course Android (AOSP)
So calm down because we will not gonna modify files from each of these folders but just a part of them:
build (Many things to do here)
Framework (Customization most of it)
Packages (Settings for sure + some other ones)
vendor (Many things also here)
So mainly these are the projects which they will be modified.
If you didn't forked framework base on Github or you don't want now to modify framework stuff it's ok but remember that when you want to modfify files in a Project repo to be yours in order to commit the changes after.
Before to proceed i want to add something you should absolutely need to know:
In order to work on the different Projects you can't work in the ROM Path because it's always better to clone that specific repo in an other folder and commit the changes.
SmartGit
Intro and Installation​
In order to commit the changes that you are going to do on the different Repositories i recommend you to use SmrtGit which is a free tool and it will help very much in the work that we will gonna do.
1) First of all if you didn't downloaded the link is situated in the first post
2) Once you downloaded unpack the tar package and unpacked it to your Desktop or /home
3) Now open the folder and go to the bin one.
Now go to the smartgit file proprieties and check if the file is executable, if it's not check the check box and open it.
g
4) Once you opneed a window will be prompted to configure SmartGit, choose the non-commercial use only and click next
5) Now choose to use SmartGit as SSH Client
6) Configure a new hosting provider which it will be Github in our case.
Insert your e-mail and after click the Generate API token button
7) Insert your master password which it will be useed for the commits
8) Insert your Github password
9) Now the that the token is generated click next
10) Now SmartGit will search if you got already repositories in your home folder, if you want to include some of yours go ahead.
11) Now next and finish. Hurray! You finished to configure SmartGit
How to use SmartGit​
Now in order to apply the incoming commits that we will gonna do, first you need to understand some concepts:
In the early post about Repo we were talked about the fact that we could have 2 kind of repositories, the forked ones and the created ones in that organization.
If you want to add a forked repo from SmartGit you will have an origin branch which is yours then it comes the upstream one.
Upstream is corresponding to the original repo that includes the branches from the Original forked repo. So when you want to add a new forked repo from your organization to Smart Git make sure that you clone it with SmartGit in order to include also the upstream tracking one because we will work and commit our changes but in the main time maybe CM will also push new commits so these commits should also be included in your forked repo.
If you want to add a created repo from your organization instead, and you also want to include the upstream changes from the native repo from where you taking the code then you will need to add the upstream for your own. So just follow my commands:
For example i will be taking Settings (The package) and i will add the upstream in order to have in my local repo also the original sources (In my case from crDroid):
Just adapt the link to your repo one.
The upstream should now be visible as it here and also in SmartGit.
It's not mandatory to include every single commit that for example Cyanogenmod make but most of them should absolutely be included. Yup,so upstream it's very important guys but it will also create difficult situations because now we will talking about the conflicts problem.
But what are exactly the conflicts?
The conflicts are generated when you want to include upstream commits to your own Repo no matter if it's created or forked, so the thing to do is only to adapt them and here once again SmartGit will save our "lives"
Why it will save our lives ?
Because SmartGit includes an inbuilt file compare which is very useful when resolving conflicts.
So to show you let's take in consideration still Settings. In my case the repo is not forked but it's created and the upstream is created for myself. So let's include some commits and see how it goes. In the major part of the cases you will not get conflicts errors. But if you do get then follow up this procedure:
As we know here is the Origin remote which is mine an the upstream remote which is crDroid one:
So what you need to do in order to include a commit made in the upstream one?
Well there are a few methods to do it.:
There is the cherry-pick method and usually is the most used to pick up two or three commits.
The merge method which allows you to merge all the missing commits from a based branch into your current one. (Here the possibility to find out conflicts are bigger)
The rebase method, which basically rebase your current branch to a specified one.
In my case i will use the merge method, and i will sync up my remote with the original crDroid one by including the missing commits.
For me everything went good, so i'm just gonna push now the new changes
Now if something go bad which means you end up with conflicts here is how you need to solve them.
Basically conflicts are appearing most of the cases because you for example modified a file and the commit which you want to apply go modifying the same file but for the fact that the file is not the same as the upstream on conflicts appear, so you need to find out a solution in order to keep your changes made to that file but in the same way including the specific commit.
When you will rebase, cherry-pick or merge the conflicted files will be the first ones to appear so to solve them here is what you need to do:
Double click the conflicted file
Now a new window will be displayed:
You will see that the file compare will be split in three parts, i mean three columns.
So let me explain you what are the three columns:
By starting from the left the first one indicates our branch the origin one.
The second one represent the Working Tree *
The third one represent the upstream branch from where we are cherry-picking or merging the commit
Working three*
The working three basically represents a detached branch,where you are working.
On local the branch is still the same (name etc..) but is being considered in a different way till you push up the changes.
If you will get familiar with this then you will not have problems with other minor issues.
So this is it, if you got questions or errors just write them on the Thread
Android Build​
So guys are you ready for the modifications?
Well, let's begin...
If you understood the last posts then you should be ready because now we will gonna work on the android_build files.
But what is android_build?
Android build is that Repo that includes all the files necessary in order to make the compilation, don't get me wrong i mean it doesn't include all the files for the compilation but includes the files which includes all the commands and strings necessary for the compilation.
So first thing to do is to fork this repo.
As in the previous post you need to go on the CM repo and to fork the android_build to your ROM organization.
And finally clone it to your computer.
So what you can modify here?
Well quite a lot of things because you can eliminate the CM name almost completely and to include your ROM name instead.
So the first file we will gonna take is the Makefile which is situated in the core folder.
So what we gonna need to modify here?
Here we will gonna modify the Target Device name + some more ones...
So first search this line:
Code:
CM_DEVICE
And change it with YourROMname_DEVICE
Done !
Now the second one is:
Code:
CM_BUILD
In the same way change the CM with your ROM name.
Now go and find these lines:
Code:
CM_TARGET_PACKAGE
CM_VERSION
In the same way change the CM with your ROM name.
On the same line which is this:
Code:
CM_TARGET_PACKAGE := $(PRODUCT_OUT)/cm-$(CM_VERSION).zip
Change also the red marked cm with your ROM name.
Now, go and find these lines:
Code:
.PHONY: otapackage bacon
CM_TARGET_PACKAGE
Ok so bacon agaain to be changed with your ROM name, and the same also for the Target Package
Tip!
That's only if want to....
If you want to include a cool banner with ascii art when the ROM has finished the compilation you can include one:
To generate strings with ascii art go HERE
Choose your prefered one and copy it.
Now go to this line:
Code:
@echo -e ${CL_CYN}"Package Complete:
Right after the line paste the generated ascii string.
But make sure to add also this little entry in order to print it in terminal:
Code:
@echo -e $(CL_CYN)
And add it for each line.
If you want to change the color of the line (cause now the color is the Cyano one)
You can choose from these ones:
Code:
@echo -e $ (CL_RED)
@echo -e $ (CL_GRN)
@echo -e $ (CL_YLW)
@echo -e $ (CL_BLU)
@echo -e $ (CL_MAG)
@echo -e $ (CL_CYN)
@echo -e $ (CL_RST)
This is just for personalize a bit your build environment
So this is it!
The Makefile is now modified and ready to be commited.
Now let's move to: config.mk which is situated still in the core folder.
Here we only need to modify one string:
Code:
ifneq ($(CM_BUILD),)
In the same way change the CM name with your ROM name.
Done !
Now let's move on dumpvar.mk which is also situated in the core folder.
If you are a maintainer you will for sure asking that i seen these lines before,
Yes you are correct!
Those lines are used to display the Compiling Info before the start process.
And those are displayed when you lunch the command: breakfast or of course brunch.
So why we are here?
We are here to change the ROM Version which it will be displayed so because in the Makefile we changed the CM_VERSION with our ROM name we need to change it also here.
Tip!
These lines are not necessary, so they can be deleted
Code:
ifeq ($(CYNGN_TARGET),true)
$(info CYNGN_TARGET=$(CYNGN_TARGET))
$(info CYNGN_FEATURES=$(CYNGN_FEATURES))
endif
So we are also done here. Now let's move on product_config.mk and envsetup.sh
Here we will change the mode about how the Compilation environment will recognize your device.
If you are a maintainer and you compiled Slim ROM or OmniROM, you will for sure notice that you need to change the cm.mk file from your device propper files with the name of the ROM for example if you want to compile SlimRom you need to change the cm.mk to slim.mk and so go on...
Soooo that's what we will gonna do.
First take the product_config.mk file located in teh core folder :
And now find these lines:
Code:
# A CM build needs only the CM product makefiles.
ifneq ($(CM_BUILD),)
all_product_configs := $(shell ls device/*/$(CM_BUILD)/cm.mk)
Now change the CM name with your ROM name (as always)
Now find this string:
Code:
CM_BUILD
And change it with your ROM name.
The same also for the next line.
Ok, so now we are done with the product_config.mk file so let's witch now on the envsetup.sh one:
Find this line:
Code:
if (echo -n $1 | grep -q -e "^cm_") ; then
Ok, now change the all the cm names with your ROM Name (as usual), after go and find this line:
Code:
CM_BUILD=
Change it as usual, the same also for the next one.
Now find this line:
Code:
if [ "z${CM_DEVICES_ONLY}" != "z" ]; then
And change it as usual. The same also for the upcoming one after 10 strings.
Again, find the bacon string and change it with your ROM Name.
Now find this line:
Code:
CM_DEVICES_ONLY
And change it as usual.
Now, go and find this line:
Code:
lunch cm_$target-$variant
And also this one change it as usual.
Now, find these lines:
Code:
MODVERSION=$(get_build_var CM_VERSION)
ZIPFILE=cm-$MODVERSION.zip
And change them as usual.
Don't worry we are nearly to the end.
The last strings which need to be modify at least are:
Code:
ro.cm.device=$CM_BUILD
CM_BUILD
So make CTRL F and search for those lines and change them with your ROM name.
So boom! Now when you will gonna compile for your device you will no longer see the CM name on it, of course that now you will need to change also the cm.mk name with your ROMName.mk situated in your Device common files.
Another thing which you can do is to add the dependencies which are an extra part and they will be explained in the Extra Part post.
Now close the two files and go and open buildinfo.sh which is situated in tools folder.
Now go and find this string:
Code:
echo "ro.cm.device=$CM_DEVICE"
Also here change it as we did in the lasts two files.
Close it, and now the last file which we will gonna modify is: roomservice.py which is situated in the tools folder.
So what this file do actually?
This file together with some others are responsible with the device build. I mean if for some reasons the device which you want to build for, isn't present in your local repo the build environment will automatically go and search in your ROM Organization (fetch) if there is such a device, so because we don't want that the build environment search in the CM Repo we need to change this file in order to search in your ROM Repo.
So first find this line:
Code:
githubreq = urllib.request.Request("https://api.github.com/search/repositories?q=%s+user:CyanogenMod+in:name+fork:true" % device)
And change the user with the ROM of the Organization from Github (exactly)
Now search for this line:
Code:
dependencies_path = repo_path + '/cm.dependencies'
And change the cm name with your ROM name (please make the ROM Name all lowercase to avoid confusion)
Now for the rest just search:
Code:
CM
CyanogenMod
And change it as we did earlier (your ROM Name)
So we finally done !
The build files are now modified and ready to be commited on Github, now when you will compile the ROM for your device you will not see anymore the CM Name
Extra features to add in Android Build files​
So this post mainly will gather user's proposed features and also mine which aren't included in the principal one.
This idea came up while i was writing the vendor part were i said that if users want to add some features to be added in the files which is not listed in the OP to write it and i will decide if is good enough to include it.
So because this thread is still WIP i will be the first to start this
Autoremove build.prop, .zip and .md5 files after each compilation​
I find a commit on the Euphoria git where a developer " Cl3Kener" (Github name) added some new features which should be included by default in my opinion..
So we know that when we make a compilation process a .md5 file will be created a .zip file will be created and also a build.prop .
Basically these files are created every time we make a new build and, to don't go and remove the build.prop every time for the new compilation or even for the zip and md5 files ,
These strings will autoremove these files every time you make a new build:
Code:
ifeq ($(MAKECMDGOALS),dirty)
+dont_bother := true
+endif
And this one also:
Code:
# Clears out zip and build.prop
.PHONY: dirty
dirty:
@rm -rf $(OUT_DIR)/target/product/*/system/build.prop
@rm -rf $(OUT_DIR)/target/product/*/*.zip
@rm -rf $(OUT_DIR)/target/product/*/*.md5sum
@rm -rf $(OUT_DIR)/target/product/*/*.txt
@echo -e ${CL_GRN}"build.prop, changelog and zip files erased"${CL_RST}
The first block of code needs to be putted here:
And the second block instead here:
Basically the end of file
Vendor files (First part)​
Now guys let's contimue the modifications also with the vendor files shaw we?
Make sure that you forked and cloned the repo to your computer with SmartGit by including also the upstream branches.
Before continue obviously we need to explain what this repo means, well exactly as from the title vendor we can assume that these vendors files are the propietary ones which every ROM have.
For example, each phone got propietary files (vendor) so the same is also here, so every ROM differ from each other.
Ok so now, for the fact that there will gonna be more things to do here i will split the vendor part in two.
In the first one we will remove all the CM stuff as in the android build.
In the second one instead we will talk about features or modifications that can be made on it.
So let's begin with the CM removable modifications:
Open the config folder.
Now here you will find multiple xml files, each of them will need to be modified.
But first let's take cm_audio.mk
The first thing to do is to remove this little cm and rename it with your ROM name (in lower case)
Now open it, and make CTRL F and search:
Code:
cm
And change it with your ROM name, do it for all of the search results.
Now you will need to do the exactly same thing also with the others located in the config folder except for the common.mk which is for later.
Now the last thing about this part is this:
Take the default.xml from platform manifest and change this line:
Code:
<project path="vendor/cm"
And change the path by changing the cm with your ROM name instead.
Now commit it and let's move on to the second part.
Vendor files (Second part)​
**Attention**
Before continue make sure to have commited the changes made earlier...
*************
Now, let's continue with the second part where we will add new features and make the latest changes....
Earlier i said that the common.mk is left for later, but i had reasons to do so.
That's because the common.mk is the most of important one (I think in my opinion).
So what we are waiting for let's open it!
The first thing you may see is : "Mooore Cyanogen stuff", yes you right bro mooore cyanogen stuff but here will be a bit different because we will not change everything at the moment because some of the strings will be left as their are.
A proper guide will be made to the Extra section where these strings will be able to be modified.
So let's go on:
The first thing to do is to change the vendor path exactly as we did in the previous files so for example:
Code:
vendor/cm/prebuilt/common/bin/backuptool.sh:install/bin/backuptool.sh \
The cm name change it with your ROM name just as you did in the previous files (lowercase)
Now go to the first string::
So change the Product Brand name with yours.
Now remove this entire ifndef because is not necessary:
Code:
ifdef CM_NIGHTLY
PRODUCT_PROPERTY_OVERRIDES += \
ro.rommanager.developerid=cyanogenmodnightly
else
PRODUCT_PROPERTY_OVERRIDES += \
ro.rommanager.developerid=cyanogenmod
endif
Now remove also this entire block:
Code:
ifndef CM_BUILDTYPE
ifdef RELEASE_TYPE
# Starting with "CM_" is optional
RELEASE_TYPE := $(shell echo $(RELEASE_TYPE) | sed -e 's|^CM_||g')
CM_BUILDTYPE := $(RELEASE_TYPE)
endif
endif
Also for this one:
Code:
ifeq ($(filter RELEASE NIGHTLY SNAPSHOT EXPERIMENTAL,$(CM_BUILDTYPE)),)
CM_BUILDTYPE :=
endif
Now remove this block and sobstitute it with this one provided by me
(To Remove)
Code:
ifdef CM_BUILDTYPE
ifneq ($(CM_BUILDTYPE), SNAPSHOT)
ifdef CM_EXTRAVERSION
# Force build type to EXPERIMENTAL
CM_BUILDTYPE := EXPERIMENTAL
# Remove leading dash from CM_EXTRAVERSION
CM_EXTRAVERSION := $(shell echo $(CM_EXTRAVERSION) | sed 's/-//')
# Add leading dash to CM_EXTRAVERSION
CM_EXTRAVERSION := -$(CM_EXTRAVERSION)
endif
else
ifndef CM_EXTRAVERSION
# Force build type to EXPERIMENTAL, SNAPSHOT mandates a tag
CM_BUILDTYPE := EXPERIMENTAL
else
# Remove leading dash from CM_EXTRAVERSION
CM_EXTRAVERSION := $(shell echo $(CM_EXTRAVERSION) | sed 's/-//')
# Add leading dash to CM_EXTRAVERSION
CM_EXTRAVERSION := -$(CM_EXTRAVERSION)
endif
endif
else
# If CM_BUILDTYPE is not defined, set to UNOFFICIAL
CM_BUILDTYPE := Release_1_Revision_1
CM_EXTRAVERSION :=
(To Add)
Code:
ifdef ROMNAME_BUILDTYPE
# If ROMNAME_BUILDTYPE is not defined, set to UNOFFICIAL
ROMNAME_BUILDTYPE := YOUR RELEASE
Now change these names:
Code:
CM_BUILDTYPE
CM_EXTRAVERSION
CM_VERSION
CM_BUILD
CM_DISPLAY_VERSION (Except for the ro.cm.display.version=$(CM_DISPLAY_VERSION) don't modify this one)
So now that the common.mk file is completed and modified, let's move on by telling you the basics things to know:
- The first thing to know is that the bootanimation is situated here in this repo in prebuilt/common/bootanimation so if you want to add a bootanimation for your own this is the place where you can store (Make sure to include different screensize for each type of device i mean the Resolution of every bootaimation)
- The default wallpaper is situated here: overlay/common/frameworks/base/core/res/res so if you want to change the wallpaper of the ROM here you will need to put it (Also here, make sure to include the wallpaper with the exact same name of the stock one and also change the wallpaper for all the drawable folders (to be sure))
- You can also add files for your own and add it to your out folder in order to be included in your ROM.
Just follow this syntax:
Code:
PRODUCT_COPY_FILES += \
Full origin path of the file / File(zip,apk it doesn't matter what type of file is) :Full destination path including also the file name\
When you finished to add your files at the last file don't put the:
Code:
/
Because at the last file to copy you don't need to put it because it means that this the last file to add and after there is nothing more to add .
Now for example this syntax:
Code:
PRODUCT_PROPERTY_OVERRIDES += \
Will be explained in the Settings section because you need also to modify some files inside the Settings sources.
Basically these are the main changes which you can made.
If you got something some new stuff which could be added just write it on the thread and i will add it on the Guide
As always after making the changes make sure to commit the changes, and if you got problems regarding this section just write it on the thread and i will answer you
Now let's move on the Settings part….
Extra fearures to add in the Android Vendor files ​
Packages​
As i stated in the OP i will make also a little part about the Packages which are included in the ROM sources before going to the Settings sources.
Well first of all let's take the packages folder from the ROM dir:
So we've got these folders.
In these folders there are several packages which you don't need it (most of it)
So these packages can be easily removed, but remember to remove also the entru from the default.xml from platform manifest in order to don't fetch the project again.
In apps
You can easily remove these projects:
CMBugReport
HTML Viewer
Speech recorder
TVSettings (Optional)
In experimental
Here i suggest you to maintain all the projects because you need them all
The same also for the providers
In screensavers
The screensavers folder instead can be entirely removed because they are also outdated and i think you don't need it for your sources.
The same also for the wallpapers folder.
Add apps to the sources
Now if you have an app and want to include it to your ROM you can add the app sources to the apps folder including in the app folder the Android.mk file.
But wait what is it?
Android.mk can be found in almost every folder of the ROM sources and represent an identity for the build environment in order know what to do with files located inside that folder.
So basically the Android.mk just tell to the build environment what to do with the files contained in that folder.
So how you can make an Android.mk ?
Simply, usually if you include basic apps, i mean apps which not require special build process by including special flags then the basic Android.mk used for the compilation of an app is this:
Code:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := YourApp name
include $(BUILD_PACKAGE)
So if you want to include an app made for your own to the ROM sources and as i said is a basic app which not requires special flags for the compilation this is the Android.mk schema to use
Before jumping and going to work on the Settings sources, another thing which in my opinion can be easily added is an OTA Updater app.
Don't worry you don't need to make an app for this but i can suggest you one made by an XDA User , it's tested by and i can asure you that is working very well, but you need to follow a bit some instructions which i think aren't so difficult to follow.
Once you red the instructions, you can fork the repo to your repo organization and start working on the sources files. I'm not going to make a guide of this but i will just tell you to be careful with the sources and to don't modify the Android.mk contained in the app sources.
And the link is this: https://github.com/Kryten2k35/OTAUpdates
That's it!
Now we can proceed with the Settings part
Settings Part​
So here we are guys, finally we arrived to the Settings sources part, which in my opinion is one of the most featured part of all.
As usual we will split the post in two parts:
CM Removable Part
Features part
But before we continue, make sure to have forked and cloned the repo to your PC.
CM Removable part​
Ok so let's begin with the CM removable stuff part.
Open the sources and go and find Android Manifest , open it, now find this activity :
Code:
<activity android:name="SettingsCMLicenseActivity"
Now delete the etire activity.
After, find also these activities, and remove them all:
Code:
<activity android:name="Settings$AnonymousStatsActivity"
<activity android:name=".cyanogenmod.ChangeLog" />
<activity android:name=".cyanogenmod.ContributorsCloud" />
Now go to res/values/cm_strings
And remove all these lines:
Code:
<!-- Anonymous Statistics #CM -->
<!-- About device screen, list item title. Takes the user to the screen about opting in or out of anonymous statistics. -->
<string name="anonymous_statistics_title">CyanogenMod statistics</string>
<string name="anonymous_statistics_summary">Help make CyanogenMod better by opting into anonymous statistics reporting</string>
<string name="anonymous_statistics_warning_title">About</string>
<string name="anonymous_statistics_warning">Opting into CyanogenMod Statistics will allow non-personal data to be submitted to the
developers of CyanogenMod to track unique installations across devices. The information submitted includes an unique identifier,
which does not compromise your privacy or personal data. The data is submitted during each boot.\n\nFor an example of the data that is submitted, tap on Preview Data.</string>
<string name="enable_reporting_title">Enable reporting</string>
<string name="preview_data_title">Preview data</string>
<string name="view_stats_title">View stats</string>
<string name="anonymous_learn_more">Learn more</string>
Now go to res/drawable-hdpi
And remove this png:
Code:
ic_cm_stats_notif.png
Now go to res/drawable-mdpi
And remove the same png also here.
And finally the same also for drawable/xhdpi
After go to res/xml/device_info_settings
And delete this whole preference screen:
Code:
<!-- System update settings - launches activity -->
<PreferenceScreen android:key="system_update_settings"
android:title="@string/system_update_settings_list_item_title"
android:summary="@string/system_update_settings_list_item_summary">
<intent android:action="android.settings.SYSTEM_UPDATE_SETTINGS"
android:targetPackage="com.cyngn.fota"
android:targetClass="com.cyngn.fota.SystemUpdateActivity" />
</PreferenceScreen>
<PreferenceScreen android:key="additional_system_update_settings"
android:title="@string/additional_system_update_settings_list_item_title">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="@string/additional_system_update"
android:targetClass="@string/additional_system_update_menu" />
</PreferenceScreen>
<!-- CyanogenMod Updates -->
<PreferenceScreen android:key="cm_updates"
android:title="@string/cmupdate_settings_title"
android:summary="@string/system_update_settings_list_item_summary">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.cyanogenmod.updater"
android:targetClass="com.cyanogenmod.updater.UpdatesSettings" />
</PreferenceScreen>
This one also:
Code:
<!-- Contributors cloud -->
<PreferenceScreen android:key="contributor_cloud"
android:title="@string/contributor_cloud_title"
android:fragment="com.android.settings.cyanogenmod.ContributorsCloud" >
</PreferenceScreen>
This one also:
Code:
<!-- CM License information -->
<PreferenceScreen
android:key="cmlicense"
android:title="@string/cmlicense_title">
<intent android:action="android.settings.CMLICENSE" />
</PreferenceScreen>
And also this one:
Code:
<!-- Change Log -->
<PreferenceScreen android:key="changelog"
android:title="@string/changelog_title"
android:fragment="com.android.settings.cyanogenmod.ChangeLog" >
</PreferenceScreen>
Now find also these xml files: which are located in the same folder:
Code:
anonymous_stats.xml
preview_data.xml
And delete them.
Now return to the main directory of settings and go to src/com/android/settings/Settings
Find:
Code:
CMLicenseActivity.java
And delete it.
Now go here: src/com/android/settings/cyanogenmod/
Find:
Code:
ContributorsCloud.java
And delete it.
Now go here: src/com/android/settings
Open:
Code:
DeviceInfoSettings.java
And delete the following lines (in order):
Code:
import android.content.pm.PackageManager.NameNotFoundException;
private static final String KEY_CM_UPDATES = "cm_updates";
Code:
// Only the owner should see the Updater settings, if it exists
if (UserHandle.myUserId() == UserHandle.USER_OWNER) {
removePreferenceIfPackageNotInstalled(findPreference(KEY_CM_UPDATES));
} else {
getPreferenceScreen().removePreference(findPreference(KEY_CM_UPDATES));
}
Code:
private boolean removePreferenceIfPackageNotInstalled(Preference preference) {
String intentUri=((PreferenceScreen) preference).getIntent().toUri(1);
Pattern pattern = Pattern.compile("component=([^/]+)/");
Matcher matcher = pattern.matcher(intentUri);
String packageName=matcher.find()?matcher.group(1):null;
if(packageName != null) {
try {
PackageInfo pi = getPackageManager().getPackageInfo(packageName,
PackageManager.GET_ACTIVITIES);
if (!pi.applicationInfo.enabled) {
Log.e(LOG_TAG,"package "+packageName+" is disabled, hiding preference.");
getPreferenceScreen().removePreference(preference);
return true;
}
} catch (NameNotFoundException e) {
Log.e(LOG_TAG,"package "+packageName+" not installed, hiding preference.");
getPreferenceScreen().removePreference(preference);
return true;
}
}
return false;
}
Now save and close it.
After that go here: src/com/android/settings/
Open
Code:
Settings.java
And delete this line:
Code:
public static class AnonymousStatsActivity extends Settings { /* empty */ }
Save and close it.
Now the last part delete these java files:
Code:
src/com/android/settings/cmstats/AnonymousStats.java
src/com/android/settings/cmstats/PreviewData.java
src/com/android/settings/cmstats/ReportingService.java
src/com/android/settings/cmstats/ReportingServiceManager.java
src/com/android/settings/cmstats/Utilities.java
Now the very last part of these modifications....
Go here: src/com/android/settings/cyanogenmod/
And cut the ChangeLog.java file because we will need it to your Desktop.
So that's it.
Mostly these are the files to be deleted but as always if you consider that some other CM stuff needs to be deleted just write it on the Thread and i will add them
Now let's move on to the second part!
Features part​
Ok so finally we can talk about the features in Settings.
Here you can add plenty of things, and i will try now to include now to most important ones but as always if you got some new ones that you consider that can be added to the Guide just write it on the thread and i will looking forward to add them
I will add also here a difficulty level exactly as i did in the Extra Features part.
So let's start guys
Add more info about phone like Hardware etc...​
Difficulty level:
Difficulty level: (*°°°°)
This is optionally but if you want to include more hardware informations just follow this mini guide .
First go to res/values
Now create a new strings xml fine starting in this way:
Code:
romname_strings.xml (all lowercase)
Ok, now open it and include the following strings:
Code:
<!-- About device screen, Hardware info -->
<string name="hardware_info">Hardware info</string>
<!-- About device Screen, hardware info, rear camera -->
<string name="device_rear_camera">Rear camera</string>
<!-- About device Screen, hardware info, front camera -->
<string name="device_front_camera">Front facing camera</string>
<!-- About device Screen, hardware info, screen res -->
<string name="device_screen_resolution">Screen resolution</string>
<!-- About device Screen, hardware info, GPU info -->
<string name="gpu_info">GPU</string>
<!-- About device screen, Cpu info. -->
<string name="cpu_info">CPU</string>
<!-- About phone screen, Free memory info -->
<string name="mem_info">Memory</string>
Ok, now save and close it.
Now go to the xml folder
And open:
Code:
device_info_settings.xml
And add the following lines at the bottom:
Code:
<PreferenceScreen
android:key="hardware_info"
android:title="@string/hardware_info">
<!-- Device cpu info -->
<Preference android:key="device_cpu"
style="?android:preferenceInformationStyle"
android:title="@string/cpu_info"
android:summary="@string/device_info_default"/>
<!-- Device gpu info -->
<Preference android:key="device_gpu"
style="?android:preferenceInformationStyle"
android:title="@string/gpu_info"
android:summary="@string/device_info_default"/>
<!-- Device mem info -->
<Preference android:key="device_memory"
style="?android:preferenceInformationStyle"
android:title="@string/mem_info"
android:summary="@string/device_info_default"/>
<!-- Device rear camera -->
<Preference android:key="device_rear_camera"
style="?android:preferenceInformationStyle"
android:title="@string/device_rear_camera"/>
<!-- Device front camera -->
<Preference android:key="device_front_camera"
style="?android:preferenceInformationStyle"
android:title="@string/device_front_camera"/>
<!-- Device screen resolution -->
<Preference android:key="device_screen_resolution"
style="?android:preferenceInformationStyle"
android:title="@string/device_screen_resolution"/>
</PreferenceScreen>
And remove the following lines:
Code:
<!-- Device cpu info -->
<Preference android:key="device_cpu"
style="?android:preferenceInformationStyle"
android:title="@string/cpu_info"
android:summary="@string/device_info_default"/>
<!-- Device mem info -->
<Preference android:key="device_memory"
style="?android:preferenceInformationStyle"
android:title="@string/mem_info"
android:summary="@string/device_info_default"/>
Ok now save and close it.
Now go to the main dir of Settings and go to src/com/android/settings
And open:
Code:
DeviceInfoSettings.java
Now remove the following lines:
Code:
private static final String KEY_DEVICE_CPU = "device_cpu";
private static final String KEY_DEVICE_MEMORY = "device_memory";
And instead add these ones:
Code:
private static final String KEY_DEVICE_CPU = "device_cpu";
private static final String KEY_DEVICE_GPU = "device_gpu";
private static final String KEY_DEVICE_MEMORY = "device_memory";
private static final String KEY_DEVICE_REAR_CAMERA = "device_rear_camera";
private static final String KEY_DEVICE_FRONT_CAMERA = "device_front_camera";
private static final String KEY_DEVICE_SCREEN_RESOLUTION = "device_screen_resolution";
Now add these lines after this one:
Code:
setValueSummary(KEY_MOD_BUILD_DATE, "ro.build.date");
Code:
addStringPreference(KEY_DEVICE_CPU,
SystemProperties.get("ro.device.cpu", getCPUInfo()));
addStringPreference(KEY_DEVICE_GPU,
SystemProperties.get("ro.device.gpu", null));
addStringPreference(KEY_DEVICE_MEMORY, getMemInfo());
addStringPreference(KEY_DEVICE_FRONT_CAMERA,
SystemProperties.get("ro.device.front_cam", null));
addStringPreference(KEY_DEVICE_REAR_CAMERA,
SystemProperties.get("ro.device.rear_cam", null));
addStringPreference(KEY_DEVICE_SCREEN_RESOLUTION,
SystemProperties.get("ro.device.screen_res", null));
Then the last ones need to be added at the end of file:
Code:
private void addStringPreference(String key, String value) {
if (value != null) {
setStringSummary(key, value);
} else {
getPreferenceScreen().removePreference(findPreference(key));
}
}
}
That's it! Now you will be able to see more info about your phon in device info settings.
Just make sure that you add also these lines to your build.prop:
Code:
ro.device.cpu
re.device.gpu
ro.device.front_cam
ro.device.rear_cam
ro.device.screen_res
Add your own ROM banner in Settings​
Difficulty level: (*°°°°)
This one is very simple to follow and i think in my opinion everyone should add a banner to their Settings app
So first take the res folder and go to the layout folder.
And create a new xml file by adding these lines into it:
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:gravity="center" android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:src="@drawable/banner" />
</LinearLayout>
And save it as banner for example.
Now for the banner size, in my opinion you should resize you banner to a size like a : 480x180
This should fit perfectly.
Then after you prepared your banner copy it to the drawable folder and make sure that the image is saved with the "banner" name.
Now the last thing to do is to display it in Settings.
So now go to res/xml
And open:
Code:
device_info_settings.xml
And copy this line after the third line:
Code:
<PreferenceScreen android:layout="@layout/banner" android:key="od_logo" />
That's it now your logo is added in Settings!
Extra features to add in the Settings sources​
Extra Features​
This last part of the guide will be dedicated to the..... "hard features modifications", Yes let's call it in this way !
I called it in this way because by meaning hard modifications i mean that we will gonna modify more files from not just one repo but more than one.
So i will start it with some minor modifications, but mainly this part will be left to the users, because if you got talent and made some cool modifications and want to share it on the thread, i will add them to the post by including also a propper guide to it
In this post i will also include a difficulty level because as the modifications are not at the same level of all, i will include also a difficulty level in order to make it know to the Developer what he is dealing with.
As always if you got trouble just write in the thread the problem by following the schema written in the OP
That's all
Manage and add new strings to Settings and override them in the compilation process​
Difficulty level: (**°°°)
So, first of all here are the repos which we will gonna modify:
android_vendor_files
Settings (Repo)
Before continue let me give you a basic intro about what we are talking about.
For example when you are seeing a string in Settings (About phone for example) like the Version of the ROM, in order to display the version of the ROM the files beeing modified weren't just one but more than one.
So if you want to add a new string which you know that is gonna to be modified many times like the version of the ROM to display something in Settings here is what you gonna need to do:
At first let's take the Settings repo:
Now go to res/values
Now, here you have two options:
Or you take the default Strings xml and you will add there your new strings
Or you create a new xml file exactly as the Strings one is and you start adding yours there (Better this one in my opinion)
Now open Strings xml (The one created or the default one)
And create a new entry as the other ones
For example i made a string for the Revisions of my ROM.
Now you have to decide where to display this string.
In my opinion the better place is in About phone
So now go to the xml folder and search for:
Code:
device_info_settings.xml
Open it, and now create also here a new entry exactly as the others .
The only thing you need to modify is the android:title and the android:summary
If you don't need a summary of it you can just write only the android:title string as i did:
So after, we move to the Java part.
Go to src/com/android/settings
And search for:
Code:
DeviceInfoSettings.java
Open it, now you will need to create also here an entry for the new string so right after the last private static final String create another one like i did:
Now we will need to assign the value we are gonna override from the vendor files more exactly,
Find this string:
Code:
setValueSummary(KEY_MOD_VERSION,"ro.cm.display.version");
In this string for example we assign the value for the mod version which is the version of the ROM and we are assigning the value coming from the ro.cm.display.version which you all know that is coming from the build.prop but actually is coming from the vendor files
So do the same also for you string (Make sure that the string which the Settings one will read the value from build.prop to start with ro.)
Ok, so done that we can switch repo and go to the vendor files.
Now take the common.mk file which is located inside the config folder.
As i did an entry for the Revision number earlier in Settings, i will made an entry here:
I put it together with the build type because also this string offer informations regarding the ROM, thats' why, but you can put yours anywhere you want (But read always when you write something if it is in the right place)
Now the last thing to do is to Overrride the new value assigned in the common.mk to the desired String, as stated here:
So that's it you finally created a new string which it will gonna change in Settings everytime you change the value here in the Common.mk file.
To modify an existing one just follow the steps made earlier and you should be fine
Add a device to your Organization and add dependencies ​
Difficulty level: (*°°°°)
Another thing to be added here is the one about how to add a device to your organization and to add also propper dependencies for your device.
As you remember when we worked on Android Build i told you to change this file:
Code:
roomservice.py
This file is very important if you want to add dependencies to your device when you want to build the ROM because if you don't have the Device sources cloned to your Main Repo folder the build environment will automatically go and download them all from the Organization.
These dependencies are very useful because avoid confusions and allow also to organize better your Organization.
So what you need to do ?
First go and clone your device tree for example (Not the vendor one) to your Organization
Image
I choosed the ariesve one which is mine.
Clone it to your desktop in order to work on it.
Now before to continue you need to think what dependencies to add i mean to be downloaded, usually the common ones are:
Kernel
Vendor (propietary)
But if you will need to add more repo, just need to follow the schema that i will show you now:
Code:
[
{
"repository": "android_device_samsung_ariesve",
"target_path": "device/samsung/ariesve"
"branch": "lollipop5.1"
}
{
"repository": "android_vendor_samsung",
"target_path": "vendor/samsung"
"branch": "lollipop5.1"
}
{
"repository": "android_kernel_samsung_msm7x30",
"target_path": "kernel/samsung/msm7x30"
"branch": "lollipop5.1"
}
]
This schema is just an example and is made for my device.
As you can see the schema is very simple and you can add as many repo as you want, the only thing to do when you save is to save it in this way: yourromname.dependenicies (all lower case).
We use this syntax to save the file, in order to make i t recognize to the build environment.
So if it's all good then when you will need to build for your device then the build environment will download all the dependencies needed by the device.
Note.
Make sure also to include all the repos needed in the dependencies because if the repo isn't located in the Organization then it will not be downloaded and it will be skipped automatically.
reserved10
reserved
reserved
reserved 13
Linux Distribution Part​
As stated in OP, for building you will need Ubuntu. If you already got it running somewhere on a decent machine, you're fine and can jump to the next post. If you don't like Ubuntu as Desktop system like I do and are using something else (like Arch Linux which I am using) you need to setup Ubuntu. Mostly you don't like to install a full system, so you can choose to install a chroot environment. For this, you only need a separate partition (you can also choose to do this on the partition you have your host system on, but it's better to do it on an own partition so you don't have to reinstall it when you need to reinstall the host system). In this post I'll show you how to setup a chroot environment with Ubuntu installed into it:
1. On the host system, you'll need debootstrap (for installing Ubuntu) and schroot (for chroot-ing to the new environment). On a debian based system, these packages should be installable by apt-get, so you just do
apt-get install debootstrap schroot​If you use Arch Linux like me, schroot is installable by pacman, debootstrap is available in the AUR (so just install it with yaourt). To do so you also need to install gnupg1 from the AUR (including importing the GPG key of the gnupg1 maintainer like described in the comments of the AUR package) and also ubuntu-keyring to validate the Ubuntu release after downloading.
2. If you installed debootstrap and schroot succesfully and got your partition setup and mounted (I use /mnt in this example), you do:
debootstrap --arch=amd64 trusty /mnt (optionally point to a mirror here)​This will take some time (around 500 MB will be downloaded and installed). Once this is done, you need to setup schroot. Open up /etc/schroot/schroot.conf in a text editor of your choice and put in something like this:
[trusty]
description=Ubuntu Build Environment
type=directory
directory=/mnt
users=root​Change directory to the place you mounted the partition for the chroot. To finally get into the new environment, just do
schroot -c trusty​
Environment Setup Part​Now that you have the initial system ready, some software needs to be installed so you can get started. First thing would be to install the java jdk. If you build for Lollipop and later, you'll need openjdk 7. To install that, do
apt-get update
apt-get install openjdk-7-openjdk​if you run into some errors like I did, you'll need to work around them. If you get the error "dependencies failed" (or similar), and sgml-base is in the list of packages that couldn't be installed, just do
groupadd staff
dpkg --configure sgml-base​and try to install openjdk again using the above command. If you run into errors concerning libpam-systemd:amd64 you'll need to do two things, first you do
dpkg-divert --local --rename --add /sbin/initctl​to avoid upstart and init errors and then
sed -i 's/exit 100/exit 0/' /usr/sbin/invoke-rc.d​to work around the systemd-login script not found error (known bug in Ubuntu 14.04).
Now that you've installed openjdk, you need some packages to build android from source. Install them using
apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip schedtool​Now you need to select a location inside the chroot to build. One remark here: schroot mounts your home directory from the host system into the chroot, so it's not advisable to build there. You can put the repo binary there if you like, but the sources and output directory should be somewhere else. I chose /opt/android (folder android needed to be created of course), but that's completely up to you. Also, please keep in mind that you shouldn't build as root to avoid replacing system files (just use the user from your host system, it's available under the chroot environment as mentioned earlier). Now just download the repo binary and you're ready to download the sources:
mkdir ~/bin
echo "PATH=~/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo​
Disclaimer and ROM specifications
Hey guys, so before to proceed with anything, please take 2 minutes to read this, because it may help you later.
When i was writing this thread i was thinking to allow the users to take in consideration as ROM base sources any kind of ROM, but i realized that for ROMs like AOSP, PAC or even Omni there's need more than a simply knowledge to modify the sources and make then the builds.
When i refer to AOSP i refer also to all the others AOSP based ROMs.
Those needs more time to stand on it and requires more skills rather than written here.
So the guide name was changed during the work in progress and changed to how it's now in this moment.
All CM based ROMs took as base sources are all good, so every change which i wrote here can be applied to any of the CM based ROMs.
If you want to make a try, go ahead but i will not provide support for that, i will provide my help for the ones who are making CM based ROMs.
Thanks to @jackeagle for pointing me and give me the ideas to write this part of the guide and don't forget guys, if you're having problems with the ROM compilation just go and see his guide ----> [GUIDE][COMPLETE] Android ROM Development From Source To End
So that's it, you can now close this post and go ahead with Guide
Good luck!

Building MIUI for Nexus 6p

This is how to build a functioning MIUI 8 port for the Nexus 6P.
To start, use Ubuntu 16.04 64-bit. Dependencies will change if you use a different version
Run these commands in the terminal to get all the pre-requisites.
Code:
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop maven openjdk-8-jdk pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline6-dev lib32z1-dev
From cyanogenmod wiki:
Ubuntu 16.04 (Xenial Xerus) or newer and OpenJDK: Since OpenJDK 1.7 was removed from the official Ubuntu repositories, you have a couple options:
1. Obtain OpenJDK 1.7 from the openjdk-r PPA
2. Enable experimental OpenJDK 1.8 support in CyanogenMod 13.0 (not available in earlier version). To enable OpenJDK 1.8 support, add this line to your $HOME/.bashrc file: export EXPERIMENTAL_USE_JAVA8=true.
You'll have to have to have android SDK installed as well.
http://developer.android.com/sdk/installing.html
Be sure to add the sdk tools to your path.
Once you have the tools added to your path, head over to github and make a free account.
Once you have a free account you'll be able to download the source for patchrom.
Open terminal again and run these commands.
Code:
mkdir patchrom
This will make a directory called patchrom
Code:
cd patchrom
This will put you into that directory
Code:
repo init -u git://github.com/MiCode/patchrom.git -b marshmallow
This will sync the directory with the latest tools and source
This is where you will be asked to sign into your github account.
You'll need to take into consideration which base ROM you would like to use to build MIUI.
I recommend building MTC20L pre-rooted, if you have the time and resources.
Otherwise, find a ROM that is pre-rooted and has a single system.img. This will make the process a lot easier.
If you find that the ROM has system.dat, among other system files, then you might consider another ROM.
Now, you'll need to copy a few files from the ROM. (or you can run make workspace in the same directory as stockrom)
framework.jar services.jar telephony-common.jar and wifi-service.jar
These should all be located in the /system/framework/ of the ROM you chose.
Decompile these with apktool.
The decompiled folders should be labeled
framework.jar.out services.jar.out telephony-common.jar.out and wifi-service.jar.out respectively.
Back to building.
You'll notice that there is already an angler folder located inside of the patchrom directory. This is a very old base, and does not boot without modification.
That is why we are building from a different ROM, and with a slightly different method than found on the patchrom github.
Remove everything from the /patchrom/angler/ folder
Place all of the decompiled folders into this directly, and make sure they are named appropriately.
Place the ROM you chose as a base in this directory as well.
Rename the ROM to stockrom.zip - This is important for the makefile
The makefile found in the github prokect is a start, but you'll need to make your own. You can ask for more help with that in this thread.
~ https://github.com/MiCode/patchrom_angler/blob/marshmallow/makefile ~ Use this for ideas. Yours will not be identical
Using @STRYDER~007 's words to better understand the makefile
"Explanations:-
'local-zip-file' = Name of your original Base ROM zip
'local-out-zip-file' = Name for your finished MIUI rom
'local-modified-apps' = Apps that will be modified to fit in with the framework. They need to be modified because they contact with the system
'local-remove-apps' = Apps that will be removed from the original ROM
'local-pre-zip' = Refers to code-block that should be executed before the zip is done.
'local-after-zip' = Refers to code-block executed after the zip is completed
'local-zip-misc' = The code-block just described at 'local-pre-zip'. It adds some Google Apps and a build.prop
'local-test' = Another code-block"
Once you have a makefile established you can move on to your first build.
Open the terminal again
Code:
cd patchrom
. build/envsetup.sh
cd angler
make workspace - (if you didn't manually decompile)
make firstpatch
This will vary in length depending on your machine
Once that has completed you'll need to look through the /patchrom/angler/temp/rejects/ folder and the terminal to find all of the manual patches that you'll need to apply.
Here is the tutorial that I used - http://forum.xda-developers.com/chef-central/android/guide-patchrom-rejects-fixing-tutorial-t3203287
After you have successfully manually patched everything, you can run the final command in the terminal for now
Code:
make fullota
This will create a file called fullota in the /patchrom/angler/ directory.
You can test to see if it will boot. You will still need to flash the vendor file that matches your stock rom of choice.
At the time I built, some extra modifications needed to be made to the boot.img
I used @superR 's kitchen to decompile the boot.img - http://forum.xda-developers.com/chef-central/android/kitchen-superrs-kitchen-t3202296
Set the current status to the following (unless you prefer otherwise)
Add/Remove init.d support: Enabled
Insecure/Secure: Insecure
Remove dm-verity: Disabled
Add/Remove forceencrypt: Disabled
In short, make sure every option appears green, rather than red.
Now, you can repack the boot.img and put it back into the ROM
You should now have a booting MIUI 8 for the Nexus 6P that you built!
As some of you know, I have been working on building MIUI for the Nexus 6P for a while now.
Here is that thread where you can track progress. I was building manually, since patchrom was still on 4.4.4 at that time.
Now, Patchrom is finally on 6.0!
Here is that updated version.
If anyone would like to contribute to that project, please do!
They are a little bit behind. In my thread, we were able to get to the boot animation.
Meanwhile, building from source is still trying to get to that point.
So, please, contribute to the project!
Things to consider before building:
Patchrom is updated to marshmallow. The whole angler tree isn't added yet. You can figure it out though.
The Mi Note Pro has an 810 but is still on 5.1
The Zubia z9 max has an 810, and is on 5. MIUI 7
The oneplus 2 has an 810 and is on 5.1.1. MIUI 7
The Mi 5 has a similar, but not exact, chip. The snapdragon 820. MIUI 8 for the Mi 5 is on 6.0.1+
CM13 can work as a base.
AOSP can work as a base. (I recommend this method)
Finding a Base/Port
List of Snapdragon Devices
MIUI 8 Global Supported Devices
Resources:
Patchrom - angler
Building with patchrom - old
fix patchrom rejects
Previous XDA Thread
Tutorial
En.MIUI Tutorial
MIUI Qualcomm big fixes
MIUI port tutorial By @STRYDER~007
xiaomi.eu porting forum
Old Port INFO
My latest Logcat - "adb logcat -v long"
CYGWIN method
Logcat info
How to: Qualcomm specific
Note Pro forum Check for leaks/relevant info
Note Pro kernel source
How to port a ROM. Not MIUI specific
Note Pro/MIUI Tweaking Thread
Tools:
SuperrsKitchenUnzip ROM, Deodex, reZip, decompile .imgs, recompiles .imgs
Notepad++ Advanced text editor
Notepadqq Linux alt. For Notepad++
Meld To compare files
APKtool (De)compile apk files
Pastebin Site to dump logcats
Threads about MIUI - Nexus 6P specific:
Request
Request
Request
Request
Request
Request
Request
Development
Anyone interested in ideation? I could use a hand with the project.
I would really love to help, but I just don't have the time for it.. I could test some builds or something though.
Good news, everybody!
tr4nqui1i7y said:
Good news, everybody!
Click to expand...
Click to collapse
Can I test the bootable port...? PM me please
thatkindaguy said:
Can I test the bootable port...? PM me please
Click to expand...
Click to collapse
Yea, it's in the OP. It's available for everyone to test.
http://forum.xda-developers.com/nexus-6p/general/miui-8-alpha-t3442570/page23
Thank you @tr4nqui1i7y for putting all your time and effort in this.
mbl1979 said:
Thank you @tr4nqui1i7y for putting all your time and effort in this.
Click to expand...
Click to collapse
Thanks for staying patient. :silly:
NP bud.
OP updated to include patchrom method in near-full detail.
I'll update the OP with more info in the future. For now, it should be enough to get started.
Working on adding a few steps to the OP.
WARNING the op doesn't show all the steps when using xda labs app. Open in a browser to be sure you're seeing everything.
I'm downloading the equivalent of MTC20L for nexus 5x (MTC20K) and i can't find it pre rooted it's fine if I use the plain factory image?
And can you also share your makefile as I'm trying to build miui using a base that it's 99% similar to yours
can you elaborate further about modification in boot.img
instruction are not clear about how to mod boot.img
any specific files like miui.rc or miui8.rc you have added?
and why every marshmallow base does not generate a bootable rom why only some specific base?
What ROM did you use as a base? I mean for MIUI 8 for 6P
Sent from my Nexus 5X using Tapatalk

Categories

Resources