Assembling MIUI v5 from official sources | Here we collect the latest MIUI for all android devices



Rep: (1265)
Building MIUI v5 from official sources

Step в„–1: Preparation
First of all, we need a UNIX like system, I recommend Ubuntu 13.10 (following all the steps will be carried out on the example of the OS)
Dare, to deliver better system natively create a partition on the disk vindovskom. If you will take to create razdel-not less 80 GB.
A virtual machine set is not recommended, because it will be very much lag, and collect about 4-6 hours. Also, you must be of a custom rekaveri rights and Ruth on the phone ...
Step в„–2: Setting environments and packages
Once established of Ubuntu, we proceed to configure it, which is necessary before you start to collect the firmware ...
1) Installing the JDK (Java Development Kit)
Here it is necessary to establish first of all. And do not tell me that you already have some there JDK !!! Yes, indeed, in the same Linux Mint / Ubuntu is already predustanvlenny the OpenJDK, but I will say at once - it is for us to build an android is not suitable,it needs JDK from Sun . And yet that was version 1.6! Why are old, there is a new 1.7 ?! The fact that the new JDK is not yet "friendly" with the current source and therefore need just version 1.6.
And so, go to the websitewww.oracle.com, Checking in there ...
Next, go toHEREand swing depending on the bit jdk-6u45-linux-i586.bin or jdk-6u45-linux-x64.bin.
Downloads? Okay, now let's say it's all good download to our home directory (/ home / username), and if you download, etc. Place premestite in the home directory for convenience. Now perform some manipulations with the downloaded file. Open the properties of the fyla on the 'Rules' tab, put a cross in puntke "Allow executing file as program."
Open the terminal and write:
1.1.
sh jdk-6u45-linux-i586.bin
or
sh jdk-6u45-linux-x64.bin
if you have a 64 bit system and a package ...
1.2. As a result, the directory will jdk1.6.0_45. For convenience, rename it to jdk. Binaries can be removed.
Now, so that the compiler knows where our Java lies, we indicate the path to it:
export PATH = $ PATH: ~ / jdk / bin

Each time not to write this line again, neobhozhimo throw it in the .bashrc file, it is located in your home directory. If such faylv not exist, create it.
Fine! With Java sorted out, we move on.
2) the installation package.
2.1. Execute the command:
sudo apt-get install -y git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool g ++ - multilib lib32z1-dev lib32ncur -dev lib32readline-gplv2-dev libxml2-utils u-boot-tools libc6-dev x11proto-core-dev libx11-dev: i386 libreadline6-dev: i386 libgl1-mesa-glx: i386 libgl1-mesa-dev mingw32 tofrodos python-markdown xsltproc

3) Android SDK, adb and fastboot.
Let's goHEREand swing Android SDK. Download, unzip and rename it for ease of sdk.
3.1. Update the SDK:
cd ~ / sdk / tools
sudo sh android update sdk -u
Now we wait until the updated SDK and download the necessary files ...
3.2. Put ADB:
cd ~ / sdk / tools && ./android update adb

3.3. Download fastboot binaryfrom here, Let down in the platform-tools, and then run the following command:
cd ~ / sdk / platform-tools / && sudo cp adb / usr / bin / adb && sudo cp fastboot / usr / bin / fastboot && sudo chmod 755 / usr / bin / adb && sudo chmod 755 / usr / bin / fastboot

3.4. To use fastboot, for example, we want to fill in the resulting firmware via fastboot, or just perform a manipulation device via adb, it is necessary to make so that the computer "see" our phone. On Windows, this is called "install usb-wood", and we have on Linux is called "zakonnektitsya of ADB": D
Execute the command:
sudo gedit /etc/udev/rules.d/51-android.rules

And in the open editor inserts the text:
SUBSYSTEM == "usb", ATTR {idVendor} == "xxxx", MODE = "0666", OWNER = "y"


How to determine what to insert for the place "xxxx" and "y"?
Instead of "xxxx" we inserted a 4-digit code of the vendor of our device. To get it, disconnect the device from the USB, run the following command:
lsusb

Then connect the device to the USB and try again. You will see a new line. We need characters after the "ID" and before "". For example, for my HTC, there is such a line here:
Bus 003 Device 009: ID 0bb4: 3011

0bb4 - it is the vendor code.
Instead of "y" - the name of the owner and the group as a cat. he is in. Learn command:
id

Well, I think everything will be clear here without explanation))
Example. After all the manipulations, in relation to my HTC One X +, I got here is a 51-android.rules:
SUBSYSTEM == "usb", ATTR {idVendor} == "0bb4", MODE = "0666", OWNER = "nowenui"


Then in ~ / .android / adb_usb.ini you need to add the line:
0x "xxxx"
in relation to my HTC:
0x0bb4

Finally add in ~ / .bashrc (or enter the terminal if no .bashrc file)
export PATH = $ {PATH}: ~ / sdk / tools
export PATH = $ {PATH}: ~ / sdk / platform-tools

All. Save. Close.
In this environment the setting is completed ...
Step в„–3. Jump source and preparation for compilation
Now we have the most difficult and tedious step ((
We set up and swing the source, which weighs about 7-10 GB (
1) Create a folder for the source code:
mkdir MIUI

2) Create a folder for repo package to pump sources:
mkdir ~ / bin

3) set the path to the folder in the environment:
PATH = ~ / bin: $ PATH

4) Fill the Repo tool in the bin folder:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo>~ / bin / repo

We do not use Google release, because it does not work ...
5) Make the file executable repo
chmod a + x ~ / bin / repo

6) Go to the MIUI folder where you will pour the source ...
cd MIUI

7) Initialize the repository:
If an ordinary device:
repo init -u git: //github.com/MiCode/patchrom.git -b jellybean42

If MTK:
repo init -u git: //github.com/MiCode/patchrom.git -b jellybean42-mtk

If everything is successful, the folder will appear in the MIUI .repo hidden folder, which is the repository ..
8) Load source from the server:
repo sync -f

This is the team nervous. Download source about 6-10 GB. With my modem megaphone with m / n 30 GB Internet, it tilts the whole day at 1 mb / s
-F prefix enables PUMP with cliffs Ineta.
After a successful (!!!) jumps to the next step ...
Step в„–4. Porting MIUI v5
We downloaded the source. Now you have to add support for new devices, aka port on your device. Started !!!
1) Create a folder for our phone in the folder with the source (in the official manual folder called xblade, Image phone call)
mkdir phone

2) Select the folder with the source
. build / envsetup.sh

3) Go to the folder phone
cd phone

4) Connect your phone via cable, and we start adb with super user privileges
sudo adb kill-server
sudo adb start-server

If at this stage there are errors, then, work with the Android SDK and binaries adb and fastboot
5) proceed incustom rekaveri. Just make a reservation, yet we need ROOT the phone
adb reboot recovery

6) look spoiler below (ATTENTION!!! Only for MTK )
A special step for MTK. If you do not miss a step MTK-
file / patchrom / tools / releasetools / ota_target_from_phone looking code
# In recovery mode, dump the boot image from device
function dump_bootimage {
echo "Dump bootimage from device"
if [-f dumpimage.sh]; then
./dumpimage.sh $ TARGET_FILES_DIR / BOOTABLE_IMAGES
else
local info = `adb shell cat /etc/recovery.fstab | grep boot | sed -e "s / \ s \ + /: / g" `
local fstype = `echo $ info | cut -d ":" -f2`

if [ "$ fstype" == "mtd"]; then
mtdn = `adb shell cat / proc / mtd | grep boot | cut -f1 -d ":" `
device = / dev / $ fstype / $ mtdn
else
device = `echo $ info | cut -d ":" -f3`
fi
adb pull $ device $ TARGET_FILES_DIR / BOOTABLE_IMAGES / boot.img
fi
}

We replace it with the following code:
# In recovery mode, dump the boot image from device
function dump_bootimage {
echo "Dump bootimage from device"
if [-f dumpimage.sh]; then
./dumpimage.sh $ TARGET_FILES_DIR / BOOTABLE_IMAGES
else

# In case of MTK, doing an adb pull of / dev / bootimg will lead to Gigs of junk
echo "Please copy your boot.img to $ TARGET_FILES_DIR / BOOTABLE_IMAGES / boot.img \ n"
echo "Once copied, press enter to continue \ n"
read
return;
echo "If you are on MTK and reading this, you are **** ed \ n"
read

local info = `adb shell cat /etc/recovery.fstab | grep boot | sed -e "s / \ s \ + /: / g" `
local fstype = `echo $ info | cut -d ":" -f2`

if [ "$ fstype" == "mtd"]; then
mtdn = `adb shell cat / proc / mtd | grep boot | cut -f1 -d ":" `
device = / dev / $ fstype / $ mtdn
else
device = `echo $ info | cut -d ":" -f3`
fi
adb pull $ device $ TARGET_FILES_DIR / BOOTABLE_IMAGES / boot.img
fi
}

And then proceed to the next step!

7) Ckachivaem the drain firmware from your phone
../tools/releasetools/ota_target_from_phone -r

8) Create a file makefile and enter into it
# The original zip file, MUST be specified by each product
local-zip-file: = stockrom.zip
# The output zip file of MIUI rom, the default is porting_miui.zip if not specified
local-out-zip-file: = MIUI_IOCEAN.zip
local-miui-modified-apps: =
# All apps from original ZIP, but has has smali files chanded
local-modified-apps: =
# All apks from MIUI
local-miui-removed-apps: =
# All apps need to be removed from original ZIP file
local-phone-apps: =
# To include the final ZIP file,
# and the local targets targets should:
# (1) if using any global variable (see porting.mk)
# (2) to prevent conflict with global targets
local-pre-zip: = local-zip-misc
# Could be zod2sd
# deliver the zip file to the phone
include $ (PORT_BUILD) /porting.mk
local-zip-misc:
local-test:

9) Then we get the source code from the phone freymvorkov
make workspace

10) Superpose MIUI files and stock (Frames liby etc)
make firstpatch

We have ported our MIUI device !! Congratulations! We proceed to the last step ...
Step в„–5. MIUI assembly for just ported devices
To collect the firmware, we need only one command:
make fullota

After a certain time, depending on the configuration of your computer, the firmware will meet and will be in the OUT folder. Sews it on the device. If you did not run (which is possible), we determine the error through adb logcat and fix them! Good luck!
We have gathered the latest version of MIUI on your device!


Instruction was written by me, based on these articles:1, 2. She checked on the performance!
Please observe the rules of the forum and a section not flood
Sincerely, NowenUI.


Post has been editedvaalf - 24.12.17, 22:30
Reason for editing: topic name



Rep: (93)
Ok, now try ... the question - is it possible to separately download the source code, but then throw them in the correct folder?



Rep: (315)
And that so powerfully cleaned topic? Bylozh yesterday 23 page:. O

Posted 01/26/2014, 9:44:

Create a file makefile and enter into it

The last line always need a tab



Rep: (315)
iHero @ 24.1.2014, 20:45*
Ok, now try ... the question - is it possible to separately download the source code, but then throw them in the correct folder?

Why not, you can



Rep: (93)
When you run make workspace I get the following:

unzip>/ Dev / null stockrom.zip system / framework / framework_ext.jar -d out
caution: filename not matched: system / framework / framework_ext.jar
make: *** [framework_ext.jar.out] Error 11


The firmware on the phone CM 10.1 4.2.2

--------------------

Problem was solved now kogoda doing make fullota, it gives

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 17, --target-sdk- version, 17, -F, /tmp/APKTOOL4585256205968869723.tmp, -x, -0, arsc, -S, / home / ihero / sdk / tools / MIUI / phone / out / framework-res / res, -M, / home / ihero / sdk / tools / MIUI / phone / out / framework-res / AndroidManifest.xml]
at brut.androlib.Androlib.buildResourcesFull (Androlib.javaUE58)
at brut.androlib.Androlib.buildResources (Androlib.java:283)
at brut.androlib.Androlib.build (Androlib.java:206)
at brut.androlib.Androlib.build (Androlib.java:176)
at brut.apktool.Main.cmdBuild (Main.java:228)
at brut.apktool.Main.main (Main.java:79)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 17, --target-sdk-version, 17, -F, / tmp /APKTOOL4585256205968869723.tmp, -x, -0, arsc, -S, / home / ihero / sdk / tools / MIUI / phone / out / framework-res / res, -M, / home / ihero / sdk / tools / MIUI /phone/out/framework-res/AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage (AndrolibResources.javaUE57)
at brut.androlib.Androlib.buildResourcesFull (Androlib.java.7336)
... 5 more
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 17, --target-sdk-version, 17, -F, /tmp/APKTOOL4585256205968869723.tmp, - x, -0, arsc, -S, / home / ihero / sdk / tools / MIUI / phone / out / framework-res / res, -M, / home / ihero / sdk / tools / MIUI / phone / out / framework -res / AndroidManifest.xml]
at brut.util.OS.exec (OS.java:89)
at brut.androlib.res.AndrolibResources.aaptPackage (AndrolibResources.javaUE55)
... 6 more
make: *** [out / framework-res.apk] Error 1



Post has been editediHero - 26.01.14, 16:42



Rep: (2027)
iHero,
Apparently apktool not cope, try updating to the latest versionhttp://code.google.com/p/android-apktool/

iHero @ 26.01.2014, 16:11*
The firmware on the phone CM 10.1 4.2.2

The patch for compatibility with the CM used?http://en.miui.com/forum.php?mod=redirect&goto=findpost&ptid=6395&pid=119781



Rep: (93)
narkoman88,
No, I do not try primenyal..pozzhe now Ubuntu is not at hand, be sure to accomplish your goal



Rep: (16)
I will try to port to z1 ...
Ie. MIUI is based on the drain firmware from Sony, which is now installed on my phone? Maybe better to use as a basis cyanogenmod?
And the final question is whether the android version of schematic? Will it be possible to port to 4.4?



Rep: (2027)
MakDenis @ 27.01.2014, 19:45*
And the final question is whether the android version of schematic?

Naturally.
MakDenis @ 27.01.2014, 19:45*
Will it be possible to port to 4.4?

No. Until Xiaomi MIUI does not lay out the repository 4.4, rumored move to 4.4.h will be at the end of February.

Post has been editednarkoman88 - 27.01.14, 20:34



Rep: (8)
NowenUI @ 24.01.2014, 08:12*
3.4. To use fastboot, for example, we want to fill in the resulting firmware via fastboot, or just perform a manipulation device via adb, it is necessary to make so that the computer "see" our phone. On Windows, this is called "install usb-wood", and we have on Linux is called "zakonnektitsya of the ADB"
Execute the command:
sudo gedit /etc/udev/rules.d/51-android.rules

starting with this step, nothing nepoluchaetsya what am I doing wrong? I tried to continue without drivers, so do not want to be flooded Repo and sources.
OS Linux Mint 15

Attached images
Attached Image


Post has been editeduhnoroma - 27.01.14, 20:11



Rep: (1265)
uhnoroma,
Use the built-in text editor of Systems, or install gedit using sudo apt-get install gedit

Post has been editedNowenUI - 28.01.14, 10:04



Rep: (105)
People help by performing step "../tools/releasetools/ota_target_from_phone -r" get the error:

Build full ota package: /media/cobaltum/Ubuntu-disk/miui/phone/stockrom.zip
unzipping target target-files ...
using device-specific extensions in.
unable to load device-specific module; assuming none
Traceback (most recent call last):
File "/ media / cobaltum / Ubuntu-disk / miui / tools / releasetools / ota_from_target_files", line 889, in<module>
main (sys.argv [1:])
File "/ media / cobaltum / Ubuntu-disk / miui / tools / releasetools / ota_from_target_files", line 857, in main
WriteFullOTAPackage (input_zip, output_zip)
File "/ media / cobaltum / Ubuntu-disk / miui / tools / releasetools / ota_from_target_files", line 410, in WriteFullOTAPackage
script.FormatPartition ( "/ system")
File "/media/cobaltum/Ubuntu-disk/miui/tools/releasetools/edify_generator.py", line 170, in FormatPartition
p = fstab [partition]
KeyError: '/ system'


Who faced how to solve?



Rep: (0)
by doing
../tools/releasetools/ota_target_from_phone -r
swears
Build full ota package: /root/MIUI/phone/stockrom.zip
unzipping target target-files ...
using device-specific extensions in.
unable to load device-specific module; assuming none
using prebuilt boot.img ...
Invalid maximum heap size: -Xmx4096m
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.

ERROR: signapk.jar failed: return code 1

kind of like Java, not hvanaet memory or keys -Xmx4096m error.
Where is correct, I can not find.



Rep: (69)
When the "../tools/releasetools/ota_target_from_phone -r" get the error:

python: can not open file '/tools/apkcerts.py': [Errno 2] No such file or directory
../tools/releasetools/ota_target_from_phone: line 163: /home/badrobotbender/MIUI/phone/out/target_files/META/apkcerts.txt: No such file or directory
cat: /home/badrobotbender/MIUI/phone/out/target_files/META/apkcerts.txt: No such file or directory
../tools/releasetools/ota_target_from_phone: line 165: /home/badrobotbender/MIUI/phone/out/target_files/META/temp.txt: No such file or directory
mv: can not stat for В«/home/badrobotbender/MIUI/phone/out/target_files/META/temp.txtВ»: No such file or directory
Generate metadata used to build target files ...
cp: can not stat for В«/home/badrobotbender/MIUI/phone/out/target_files/META/apkcerts.txtВ»: No such file or directory
cp: can not stat for В«/home/badrobotbender/MIUI/phone/out/target_files/META/filesystem_config.txtВ»: No such file or directory
cp: can not stat for В«/home/badrobotbender/MIUI/phone/out/target_files/RECOVERY/RAMDISK/etc/recovery.fstabВ»: No such file or directory
Compress the target_files dir into zip file
/ Home / badrobotbender / MIUI / phone
Build full ota package: /home/badrobotbender/MIUI/phone/stockrom.zip
../tools/releasetools/ota_target_from_phone: line 256: / tools / releasetools / ota_from_target_files: No such file or directory
failed: Operation not permitted



Post has been editednavi-navigator - 01.02.14, 01:10



Rep: (24)
Try to create a directory to put it right 777, and all the actions to perform on the root, ie sudo to each team



Rep: (1085)
navi-navigator, and you forgot to make a case not "build / envsetup.sh" unnecessarily cha is not even in the Tools folder scripts? And sudo probably should not do it, then the tail is super Uberall zaipeshsya)

Posted 02/02/2014, 2:57:

Cobaltum, this error can be circumvented. I understand you're doing on the basis of 4.0 miui Andryusha? Eo bypassing this error is plugging on Bute. (((



Rep: (1085)
In thee what system? 32 or 64? If 32, then the idea of ​​it can not handle this amount of memory capacity (how to write science can not)) if 64 bit then it breaks the lack of operatives. Unless LAR, the popravte.



Rep: (546)
When you run make workspace's get this thing:
the makefile: 21: *** missing separator (if you did not have to mean TAB instead of eight spaces?). Stop.

What does it mean?



Rep: (69)
ruslan_3_ @ 2.2.2014, 3:57*
navi-navigator, and you forgot to make a case not "build / envsetup.sh" unnecessarily cha is not even in the Tools folder scripts? And sudo probably should not do it, then the tail is super Uberall zaipeshsya)
yes that was the problem, but now this trouble with the firmware drained from the body
FormatPartition
p = fstab [partition]
KeyError: '/ system'

Worth factory, 4.0.4. Tegra device in the third, with its incomprehensible loader, cwm as that collected by dr.ustroystva, but when the body is in cwm bb mode it does not determine all the actions I do when the device.


Post has been editednavi-navigator - 02.02.14, 08:54



Rep: (19)
The phone is now in the custom of. firmware 4.3 (i9300 device). Can I port to this firmware miui? Or is it better to use the older version?



Rep: (2027)
Munrad,
You can not. I wrote above - no source for 4.3, and most likely will not. Judging by the conversations will immediately MIUIv6 on Android 4.4.x
The repositories only
Gingerbread 2.3.x- MIUIv2
Ics 4.0.x- MIUIv4
JellyBean 4.1.x- MIUIv5 (Somewhere MIUIv4 and should be)
JellyBean 4.2.x- MIUIv5
JellyBean 4.2.x MTK-MIUIv5 MTK

Post has been editednarkoman88 - 03.02.14, 15:30


Full version    

Help     rules

Time is now: 21/05/20, 7:48