[HOW TO] Create an update.zip file - via Pershoot - Nexus One Android Development

This is all via pershoot, I hope you don't mind me posting this, as it was buried in another thread and I figure this is great for the community and these steps have never been put all in one place before.
Again, this is not my knowledge, but pershoot's.
This is assuming you're using Windows (XP/2000/2K3/Vista/7):
1. unpack this http://www.relentlessaddictions.com/Androidstuff/signing.zip to tools directory within your sdk folder.
2. run autosign.bat and go number by number
*****the creation of the image (and all related parts) are done in linux. steps 3-7
3. unpack this: http://android-dls.com/files/linux/split_bootimg.zip
4. take a boot.img from let's say, cyanogenmod rom
5. ./split_bootimg.pl boot.img
6. If you would like to modify anything in the ramdisk:
mkdir my_ramdisk
cd my_ramdisk
gzip -dc ../boot.img-ramdisk.gz | cpio -i
To pack back together:
cd ..
mkbootfs ./ramdisk | gzip > my_ramdisk.gz
Note: you can find mkbootfs in AOSP: out/host/linux-x86/bin
7. use mkbootimg (found within AOSP: out/host/linux-x86/bin (assuming your using an x86 linux host)) to create a nexus image, contained of your zImage and a ramdisk:
mkbootimg --base 20000000 --cmdline 'no_console_suspend=1 console=null' --kernel arch/arm/boot/zImage --ramdisk boot.img-ramdisk.gz -o my_bootable_file.img
8. take one of pershoot's bootable recovery update.zips (http://droidbasement.com/db-blog/?p=161)
9. replace your my_bootable_file.img with the boot.img found within the .zip
10. replace your modules folder and wifi module in the modules folder
11. feel free to amend the update-script found within META-INF\com\google\android (you can use this as a reference: http://forum.xda-developers.com/showthread.php?t=641223
12. if you setup autosigning correctly, you can now right click the .zip -> sign.
Note: on windows 7, the right click gets damaged, so to speak, if you reassign the extension after autosigning, so just open up a command prompt and: java testsign my_recovery_update.zip
13. you're all done.
To sign updates in Linux:
Follow this: http://forum.xda-developers.com/showpost.php?p=4155081&postcount=1
-pershoot
*****For Ubuntu : the mkbootimg and mkbootfs executables are found here: http://www.sendspace.com/file/p9s80w for x86 only.

Sign Tool For Linux
I seem to be able to not finish reading the OP!

I'm confused... Why can't you finish the OP?

Thanks Mark (and pershoot) for posting this, will definitely come in handy. Now I can finally post my 1.8ghz kernel

jlevy73 said:
Thanks Mark (and pershoot) for posting this, will definitely come in handy. Now I can finally post my 1.8ghz kernel
Click to expand...
Click to collapse
That was a joke, I hope lol.. at least not in update.zip format..

Eclair~ said:
That was a joke, I hope lol.. at least not in update.zip format..
Click to expand...
Click to collapse
yeah, he meant his 8.1 ghz kernel...

rori~ said:
yeah, he meant his 8.1 ghz kernel...
Click to expand...
Click to collapse
Lmao....
(10 blah)

sry my bad english
can`t do "split_bootimg.pl boot.img" out from cmd console
i dont have perl or something installed.
What am I doing wrong?
thx

crazyknallchopf said:
sry my bad english
can`t do "split_bootimg.pl boot.img" out from cmd console
i dont have perl or something installed.
What am I doing wrong?
thx
Click to expand...
Click to collapse
./split_bootimg.pl boot.img (which is implied if it is not in your path)
mark, please update the OP with ./

updated the OP to include your changes pershoot:
"./split_bootimg.pl boot.img"

sorry i don`t understand what you mean with "OP"

crazyknallchopf said:
sorry i don`t understand what you mean with "OP"
Click to expand...
Click to collapse
OP = original post (the 1st one on top of a thread)

pershoot said:
OP = original post (the 1st one on top of a thread)
Click to expand...
Click to collapse
oke thx...
in CMD i do cd to my sdk directory where my .pl and .bin files are placed,
then i type "./split_bootimg.pl boot.img" (without quotes) it does not work...
no command are found

crazyknallchopf said:
oke thx...
in CMD i do cd to my sdk directory where my .pl and .bin files are placed,
then i type "./split_bootimg.pl boot.img" (without quotes) it does not work...
no command are found
Click to expand...
Click to collapse
you put the boot.img in the same directory as the unpacked split_bootimg.pl then run a ./split_bootimg.pl boot.img
you should not be using your sdk directory as a work/scrap area, as things may get messy in there.
use something like /var/tmp/FOLDER or ~/FOLDER

EDIT: the quick brown fox jumps over a lazy dog

pershoot said:
you put the boot.img in the same directory as the unpacked split_bootimg.pl then run a ./split_bootimg.pl boot.img
you should not be using your sdk directory as a work/scrap area, as things may get messy in there.
use something like /var/tmp/FOLDER or ~/FOLDER
Click to expand...
Click to collapse
thx pershoot
i dont know what im doing wrong
it wont work
i uploadet a pic :
http://yfrog.com/2gimgoincrazyp

crazyknallchopf said:
thx pershoot
i dont know what im doing wrong
it wont work
i uploadet a pic :
http://yfrog.com/2gimgoincrazyp
Click to expand...
Click to collapse
i was afraid you were doing that. the creation of the image (and all related parts) are done in linux.
mark, might want to update the OP with that tidbit, for the linux pieces.

pershoot said:
i was afraid you were doing that. the creation of the image (and all related parts) are done in linux.
mark, might want to update the OP with that tidbit, for the linux pieces.
Click to expand...
Click to collapse
steps 3-7
.......

edited: here is the mkbootimg executable that works on ubuntu 9.10.
use at your own risk.
This was the only part that I was unable to do on a stock ubuntu install.
Was following this: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images

britoso said:
Can someone upload the mkbootimg and mkbootfs executables please.
I'm on ubuntu 9.1.
Seems like a lot of work to build just this little tool.
thanks.
Click to expand...
Click to collapse
http://www.sendspace.com/file/p9s80w
for x86 only.

Related

who can help me repack a boot.img

i have read the article http://forum.xda-developers.com/showthread.php?t=915808
i am a windows user,and i have install cgwin and perl
but i can not use unpack.boot.pl and repack.boot.pl(actually i donot know how to use it )
i unpack the boot.img by split_bootimg.pl by DOS
if anyboy can tell me how to use unpack-bootimg.pl and repack-bootimg.pl?
or help me repack the boot.img.the edited file of the boot.img i have upload to
http://cid-34cb0dc592eb3181.office.live.com/browse.aspx/.Public?uc=1
thanks
any body there?
Use dsixda android kitchen.
I run linux, but you have a perl script, so you need to run it through perl before it can work. So something like...
Code:
perl unpack.boot.pl [then the inputs for unpack.boot.pl]
I use cramfs tools so mine looks like
Code:
cramfsck -x bootextractedDIR boot.img
You can also get the dsixda android kitchen and dig through the files, since it does it too. The kitch is just a really complated cmd script, so somewhere in there you can find the command for how it extracts the boot.img
equalsP said:
I run linux, but you have a perl script, so you need to run it through perl before it can work. So something like...
Code:
perl unpack.boot.pl [then the inputs for unpack.boot.pl]
I use cramfs tools so mine looks like
Code:
cramfsck -x bootextractedDIR boot.img
You can also get the dsixda android kitchen and dig through the files, since it does it too. The kitch is just a really complated cmd script, so somewhere in there you can find the command for how it extracts the boot.img
Click to expand...
Click to collapse
But it can't pack it after unpacking: (
Need it to add kernel to bootimage. Can someone help ?
Sent from my HTC HD2 using XDA Premium App
Hello I've found this...
http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images
I could unpack the files. but mkbootfs and mkbootimg doesn't work for me. When I downloaded ROM kitchen, there files were present as mkbootfs.c and mkbootimg.c .Not sure how to make them executable
Tried compiling with gcc and also tried changing permissions using chmod. If you find anythng, please PM me...
Edit : Forgot to mention I run linux.
Okay now sorted it. Use repack_bootimg.pl tool .Download ROM kitchen and search for mkbootimg and mkbootfs tools. Copy and paste them to your working directory. Also copy all header files from dsidia ROM kitchen. Download Repack tool from web.
Use this command
perl repack-bootimg.pl <kernel> ramdisk directory.img
very happy to hear this.i will switch to my ubuntu and try again
Not work here. I have image boot from rk2918 device and pearl scripts not work for unpack.
How I can unpack?

[Q] how extract an *.ab file (Helium Backup)

Hi,
I've backup a few apps from my Nexus 5 (Unrooted),
I've copied the .ab file to my PC and I wondered how can I extract it to edit some file and then repack it again.
I've already tried to extract it using DroidExplorer but I'm getting an un-openable tar file.
Can someone please point me how to can I do it right? and how can I repack it again,
Thanks in advance!
Gilco:good:
There is a sweet guide here
UltraWelfare said:
There is a sweet guide here
Click to expand...
Click to collapse
Thanks man, I tried but I get an error while trying to extract the tar file,
also I saw this warning at the end of the guide:
Warning about Helium (Carbon): helium backups are just android adb backups that are not compressed with Java Deflater. It means they were created with the option static final boolean COMPRESS_FULL_BACKUPS = false.
A normal adb restore should work.
see log from first step:
C:\Users\Gil\Desktop\BandR>java -jar abe.jar unpack com.gameinsight.airport.ab A
C.tar
Strong AES encryption enabled
Magic: ANDROID BACKUP
Version: 1
Compressed: 1
Algorithm: none
20664320 bytes read
gilc8 said:
Thanks man, I tried but I get an error while trying to extract the tar file,
also I saw this warning at the end of the guide: ...
Click to expand...
Click to collapse
Hi all, I play a bit with the conversion from Helium backups. Here is the utility:
xaos.ic.cz/Helium_ab2tar.zip . Still don't know what are the last four bytes in the Helium .ab file. Is that some checksum or what? Anyone knows?
xaos.cz said:
Hi all, I play a bit with the conversion from Helium backups. Here is the utility:
xaos.ic.cz/Helium_ab2tar.zip . Still don't know what are the last four bytes in the Helium .ab file. Is that some checksum or what? Anyone knows?
Click to expand...
Click to collapse
Thank you so much! It's working. I was able to extract my (unencrypted) Helium backup. Did you publish the code somewhere else? Here's a Makefile in case someone wants to build it for Linux. (Just remove .txt before running make or make extract)
Archived utility on Github
Hey everyone,
since the original utility has vanished and is somewhat hard to find, I've archived it at Github for convenience: github.com/floe/helium_ab2tar
If the original author wishes, I can transfer the repo to their ownership.
Best, Floe
floemuc said:
Hey everyone,
since the original utility has vanished and is somewhat hard to find, I've archived it at Github for convenience: github.com/floe/helium_ab2tar
If the original author wishes, I can transfer the repo to their ownership.
Best, Floe
Click to expand...
Click to collapse
Hi, the "helium_ab2tar" finally helped me. Good work!
I was running Win7 and didn't have any C compiler installed, so here is what I found:
• from the link above, extract helium_ab2tar-master.zip to a new directory
• from http://gnuwin32.sourceforge.net/packages/make.htm download Binaries and Dependencies and extract files make.exe, libintl3.dll, libiconv2.dll to your helium_ab2tar-master directory
• from https://bellard.org/tcc/ download a recent TinyCC build and extract the whole zip into your helium_ab2tar-master directory
• edit the makefile and change "CC=gcc" to "CC=tcc\tcc.exe"
• change "-o ab2tar_cut" to "-o ab2tar_cut.exe", "-o ab2tar_corr" to "-o ab2tar_corr.exe", "-o tar2ab_cut" to "-o tar2ab_cut.exe", "-o tar2ab_corr" to "-o tar2ab_corr.exe"
• finally run make.exe
How to use:
ab2tar_cut [.ab file] [temporary file]
ab2tar_corr [temporary file] [.tar file]
Thanks Commander!
It doesn't work for me =(
That's what I'm getting while trying to start it thru terminal
make: *** No targets specified and no makefile found. Stop.
download https://github.com/floe/helium_ab2tar, unzip, run make.exe from helium_ab2tar-master folder
aIecxs said:
download "https://github.com/floe/helium_ab2tar"]https://github.com/floe/helium_ab2tar, unzip, run make.exe from helium_ab2tar-master folder
Click to expand...
Click to collapse
there is no such file as make.exe.
of course, you must follow the steps in Post #7
or use linux. you can use Unetbootin and install Xubuntu to usb flash drive
aIecxs said:
of course, you must follow the steps in Post #7
or use linux. you can use Unetbootin and install Xubuntu to usb flash drive
Click to expand...
Click to collapse
I did so and it gives me another error
Code:
tcc\tcc.exe ab2tar_cut.c -o ab2tar_cut.exe
process_begin: CreateProcess(NULL, tcc\tcc.exe ab2tar_cut.c -o ab2tar_cut.exe, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [ab2tar_cut] Error 2
try with full path in makefile for example CC="C:\Users\Admin\Downloads\helium_ab2tar-master\tcc\tcc.exe" (path to tcc.exe)
aIecxs said:
try with full path in makefile for example CC="C:\Users\Admin\Downloads\helium_ab2tar-master\tcc\tcc.exe" (path to tcc.exe)
Click to expand...
Click to collapse
ok it seems to work,
PS C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master> C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master\make.exe
C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master\tcc.exe ab2tar_cut.c -o ab2tar_cut.exe
C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master\tcc.exe ab2tar_corr.c -o ab2tar_corr.exe
C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master\tcc.exe tar2ab_corr.c -o tar2ab_corr.exe
C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master\tcc.exe tar2ab_cut.c -o tar2ab_cut.exe
PS C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master>
Click to expand...
Click to collapse
what's next ?
---------- Post added at 01:52 PM ---------- Previous post was at 01:47 PM ----------
aIecxs said:
try with full path in makefile for example CC="C:\Users\Admin\Downloads\helium_ab2tar-master\tcc\tcc.exe" (path to tcc.exe)
Click to expand...
Click to collapse
what should be instead of [temporary file] ?
backup.ab.tmp (or any other name)
aIecxs said:
backup.ab.tmp (or any other name)
Click to expand...
Click to collapse
PS C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master>
>> ab2tar_cut backup.ab backup.ab.tmp
ab2tar_cut : The term 'ab2tar_cut' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:2 char:1
+ ab2tar_cut backup.ab backup.ab.tmp
+ ~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ab2tar_cut:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command ab2tar_cut was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\ab2tar_cut". See "get-help about_Command_Precedence" for more details.
PS C:\Users\danbe\Downloads\folders\helium_ab2tar-master\helium_ab2tar-master>
Sorry I was using powershell for it, it doesn't work in PS but it works in CMD
Hello, I am feeling as dumb as a caveman right now because I could not figure out how to decompress and .ab file created with an old version of Helium which pretty much screw me over this.
I'm pretty much an illiterate with command lines in general. I tried cygwin but can't manage to find the right command combo, also android backup extractor doesn't even work despite I've installed the Java SE SDK etc (running Win10 x64). Can someone tell me step by step how I can decompress this hellish .ab file once for all? Thank you in advance.
P.s.= And yes, I also tryied using the method described on these last 2 pages and I get this:
C:\Users\Dingo Dash>"C:\Users\Dingo Dash\Desktop\helium_ab2tar-master\bin\make.exe" ab2tar_cut "C:\Users\Dingo Dash\Downloads\com.koushikdutta.backup\SM-G900F - 353687063301086\backup.ab" xxx.tmp
make: *** No rule to make target `ab2tar_cut'. Stop.
Click to expand...
Click to collapse
- download and edit makefile from post #5
- compile the binaries (.exe files)
- unpack backup + convert to tar
- unpack tar file
aIecxs said:
- download and edit makefile from post #5
- compile the binaries (.exe files)
- unpack backup + convert to tar
- unpack tar file
Click to expand...
Click to collapse
Thank you but I wanted to know what I was doing wrong on the prompt because I had already compiled the binaries aka followed the whole procedure.
Anyway, I managed to extract the whole damn file on another device. I don't have an explaination of why helium behaved this way but it actually worked on a more recent device instead of the original one, were the backup was created, also using a 2015 or so old version of the app, which should be the one the file came from.

[Q] Can't boot compiled stock kernel

Hi
My main goal is to disable the lcd connectivity check while the phone is booting. I have searched the net and decided to comile a kernel and disable the check. Because this is my first attempt of kernel compiling I am first trying to just compile the stock rom. I have seccessfully compiled one using these threads:
[GUIDE]Newbie's Guide to Kernel Compiling -- http://forum.xda-developers.com/showthread.php?t=2576721
[TUT]Compile a kernel from Sony source -- http://forum.xda-developers.com/showthread.php?t=2285731
After compile I have a zImage file. I need a ramdisk so I unpack the kernel.sin inside the stock .ftf file using @DooMLoRD's tools found in his github repository. So there are two files a zImage and a kernel.sin-ramdisk.cpio.gz. Then I execute this command:
Code:
mkbootimg --kernel zImage --ramdisk kernel.sin-ramdisk.cpio.gz --base 0x00200000 -o boot.img
Note: If I don't put the --base 0x00200000 tag I get wrong range error in fastboot! If it's wrong I am happy to know how I should handle it!
After that I run this command in terminal:
Code:
fastboot boot boot.img
but nothing happens. Not even a small viberation. I have read about some filler stuff to be added to the ramdisk but there is no clear explanation on how to do it exactly.
(Please help me as I am stuck for 2 days!)
thanks in advanced!
Use an alternative ramdisk like that of my kernel (or doomkernel) instead of stock ramdisk
Alternatively un pack the ramdisk and add any file ~700KB-1MB and repack it.
extract the ramdisk files
add filler
use
In that folder
Code:
find . | cpio --quiet -o -H newc | gzip > ../ramdisk.img
You will get the ramdisk.img out side the folder .
Code:
mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x00200000 -o boot.img
karandpr said:
Use an alternative ramdisk like that of my kernel (or doomkernel) instead of stock ramdisk
Alternatively un pack the ramdisk and add any file ~700KB-1MB and repack it.
extract the ramdisk files
add filler
use
In that folder
Code:
find . | cpio --quiet -o -H newc | gzip > ../ramdisk.img
You will get the ramdisk.img out side the folder .
Code:
mkbootimg --kernel zImage --ramdisk ramdisk.img --base 0x00200000 -o boot.img
Click to expand...
Click to collapse
Thanks. I have a question. Is the filler thing only for stock ramdisks or should it be done for yours too?
I added a file as you said to stock ramdisk and builded the ramdisk.img with the comand you said.
I have two files:
ramdisk.img --> 981.6KB
zImage --> 3.8MB
then I run the mkbootimg command and after that I fastboot boot but nothing happens!
mike-wright said:
I added a file as you said to stock ramdisk and builded the ramdisk.img with the comand you said.
I have two files:
ramdisk.img --> 981.6KB
zImage --> 3.8MB
then I run the mkbootimg command and after that I fastboot boot but nothing happens!
Click to expand...
Click to collapse
mike-wright said:
Thanks. I have a question. Is the filler thing only for stock ramdisks or should it be done for yours too?
Click to expand...
Click to collapse
Filler is only for stock Ramdisk.
the files are alright.
What phone are you using ?
Best solution is to use a kitchen like
http://forum.xda-developers.com/showthread.php?t=1659584
Use ramdisk of Lupus or Doom kernel...If you are using mdpi then you can use my ramdisk.
karandpr said:
Filler is only for stock Ramdisk.
the files are alright.
What phone are you using ?
Best solution is to use a kitchen like
http://forum.xda-developers.com/showthread.php?t=1659584
Use ramdisk of Lupus or Doom kernel...If you are using mdpi then you can use my ramdisk.
Click to expand...
Click to collapse
Thank you for reply. I am using xperia mini st15i. I figured it out. It was my zImage. I changed my OS to ubuntu 14.04 32 bit and compiled with @DooMLoRD's arm-eabi-4.4.3 (before I was using a ubuntu 14.04 64 bit mac version with arm-linux-eabi-4.7 toolchain) and used your (@karandpr --> Doopler) ramdisk and now my kernel boots!!!
I have another question though. Now I change one function (named check_panel_ids) in mddi_sony_s6d05a1_hvga.c in kernel drivers and it compiles well but after boot the wifi is off!!! can you help me with this problem? I don't know why!!! Why should lcd drivers change wifi compatibility???
What has happend is the wifi switch is off and grayed out. Sometimes it's ordinary but when you turn it on it just grays out! The hotspot has the same issue
I have tried to install the modules but I dont have them (I found one but it didn't work) and I dont know how to install them.
What can I do to fix this issue?
mike-wright said:
Thank you for reply. I am using xperia mini st15i. I figured it out. It was my zImage. I changed my OS to ubuntu 14.04 32 bit and compiled with @DooMLoRD's arm-eabi-4.4.3 (before I was using a ubuntu 14.04 64 bit mac version with arm-linux-eabi-4.7 toolchain) and used your (@karandpr --> Doopler) ramdisk and now my kernel boots!!!
I have another question though. Now I change one function (named check_panel_ids) in mddi_sony_s6d05a1_hvga.c in kernel drivers and it compiles well but after boot the wifi is off!!! can you help me with this problem? I don't know why!!! Why should lcd drivers change wifi compatibility???
Click to expand...
Click to collapse
mike-wright said:
What has happend is the wifi switch is off and grayed out. Sometimes it's ordinary but when you turn it on it just grays out! The hotspot has the same issue
I have tried to install the modules but I dont have them (I found one but it didn't work) and I dont know how to install them.
What can I do to fix this issue?
Click to expand...
Click to collapse
You might need to recompile the WiFi drivers.
use
Bash:
lsmod
to check if the WiFi modules are properly loaded

How to bump yourself stock kernel, modify ramdisk to add init.d + SELinux permissive

Hello,
I spent a lot of time searching and finding the material to understand and reproduce process about bump!.
After a few times shared the results of my manipulations on stock kernel, which I applied the method I'll describe here, I will try now to explain how you can make for yourself an identical result.
If you are still wondering what is Bump! I can only invite you to look for yourself, and even give you the link where I tried to answer this question on the section of the G2.
The purpose of this topic is to get you to bump kernel, from a PC, Linux, or Windows, or even from the phone.
I'll try to explain as why certain steps are essential to ensure a good result, steps that, at first, did not seem obvious.
When you will try it, and will want to test the result, make sure nice to have taken the necessary precautions before: Make a backup of your current kernel foremost flashing.
Now, you know what is BUMP! and why kernel must be bumped. Bump! basically involves injecting a signature in a file (boot).
This injection of the signature to be made in hexadecimal format, and immediately after the last used page of the kernel, we have to remove unnecessary bytes before doing so, and unpack/repack kernel is the easiest way to do so (http://forum.xda-developers.com/showpost.php?p=60086231&postcount=42). To do that, we need two binaries (unpackbootimg and mkbootimg).
About these two binaries, we can compile them ourselves from source, or taking already compiled bins.
@osm0sis made and share a super tool containing all that we need, these compiled bins, in his Android Image Kitchen - Unpack/Repack Kernel Ramdisk [Win/Android/Linux].
So i propose to use it here. The big advantage to this, is that @osm0sis compiled for windows, linux, and phone (arm). He created scripts that automate unpack and repack too.
The purpose of this topic is not to learn how to get the kernel file (boot), I assume that this prerequisite is acquired. However, I give you some hints for beginners, you can take a look at KDZ and TOT Extractor from @bullghost or the dd command to achieve.
1) Simply Bump a stock kernel in Linux (no change in ramdisk) to obtain a bumped working untouched stock kernel
Download the linux version of Android Image Kitchen - Unpack/Repack Kernel Ramdisk [Win/Android/Linux] ( AIK-Linux-v1.9.1-ALL.tar.gz), and untar it somewhere. Create, in the root directory of AIK, one file named "one_shot_bump.sh" (or the name that you like) containing this code I gave in osm0sis AIK thread (or, if you prefer, you can take the file named "linux_one_shot_bump_only.tar.gz" in attached files here), and chmod it 755.
Now you can use it by opening a terminal and drag and drop this file inside following by drag and drop kernel file too. Press enter, it's done You'll find a file named bumped.img, in AIK root directory, wich is your bumped kernel.
Note: bash for this script is very important for an expected result for printf cmd. It doesn't work as expected with sh.
2) Simply Bump a stock kernel in Windows (no change in ramdisk) to obtain a bumped working untouched stock kernel
I've not made a one click script to bump on this OS, but I'll explain very simply how to get there using the scripts offered natively in the osm0sis tools . This fair will be in three stages, for the reasons discussed in the preamble:
1) unpack the kernel
2) repack the kernel
3) inject hexa signature (bump!)
So to begin, download the windows version of Android Image Kitchen - Unpack/Repack Kernel Ramdisk [Win/Android/Linux] (Android.Image.Kitchen.v2.3-Win32.zip).
Unzip it where you want. Open a dos prompt and drag and drop unpackimg.bat on the prompt windows, tape one spaces in the command and drag and drop your kernel file in the prompt windows. Tape on enter: You made the first step, your kernel is unpacked.
Don't close window prompt, tape one touch to continue, as the prompt invite you to do.
Now, just drag and drop repackimg.bat in the prompt windows, and tape on enter. Done, you just finished the second step, you've repacked the kernel (image-new.img on the root folder of AIK).
Now, for doing the step 3, you need to inject the signature. I have not found other solutions at the moment than to use a hex editor to do this. I tried with a shareware (Hex Editor) and also with a freeware (HxD) with succes for these two softwares. With Hex Editor, after opening image-new.img, click on the first free byte at the end of the file and copy paste there "41A9E467744D1D1BA429F2ECEA655279" (without double quote). Save the file.
Or with HxD, after opening image-new.img, click at the end of the file, just after the last used byte, and in the menu"edition", choose "insert bytes". On the dialog box, type 10 on the first field (amount), let "hex" checked, and paste in the second field the value "41A9E467744D1D1BA429F2ECEA655279" (without double quote). Save the file.
Done, you just finished bumping your kernel in windows
I can give later screenshot if needed/asked.
Edit: i've found a workaround for using @osmosis tool to sign (bump) kernel just after repacking. Details can be found here: http://forum.xda-developers.com/showthread.php?p=63884919#post63884919
Edit2: After talking with @osmosis, the best solution for signing (bump) the kernel just after repacking should be to use cygwin printf.exe (I've attached this file to this post), that can be added in aik/bin folder (the real name of this folder is android_win_tools and it can be found in the root of AIK tool). So we just need to put printf.exe in android_win_tools folder, and replace this code in repackimg.bat
Code:
%bin%\mkbootimg --kernel "split_img/%kernel%" %ramdisk% %second% --cmdline "%cmdline%" --board "%board%" --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% %second_offset% --tags_offset %tagsoff% %dtb% -o image-new.img %errout%
by
Code:
%bin%\mkbootimg --kernel "split_img/%kernel%" %ramdisk% %second% --cmdline "%cmdline%" --board "%board%" --base %base% --pagesize %pagesize% --kernel_offset %kerneloff% --ramdisk_offset %ramdiskoff% %second_offset% --tags_offset %tagsoff% %dtb% -o image-new.img %errout%
%bin%\printf \x41\xA9\xE4\x67\x74\x4D\x1D\x1B\xA4\x29\xF2\xEC\xEA\x65\x52\x79 >> image-new.img
As you can see, just one new line was inserted for injecting the signature.
3) Simply Bump a stock kernel in Phone (no change in ramdisk) to obtain a bumped working untouched stock kernel
I will not reinvent the wheel, you can use an existing tool for some time, made by @somboons, which uses the technique I mentioned here (unpack the kernel, repack it and injection of signing , all in the phone).
This script is an adaptation of Live bump by @Skin1980 that uses the arm versions of unpackbootimg and mkbootimg.
You will find the instructions and the tool here:
http://forum.xda-developers.com/lg-g2/development/tools-bump-kernel-offline-t3073261
---​
Credits and thank's a lot:
codefire team for bump!:
@thecubed , @Shelnutt2 , @IllegalArgument , @autoprime , @AnimatronicRocketReptile , @Dees_Troy
@Skin1980 for his live bump and these explanations
@osm0sis for his Android Image Kitchen - Unpack/Repack Kernel Ramdisk [Win/Android/Linux]
@zequav for explain me at the beginning what happen with bump and what can be done on linux
How to add init.d support and SELinux permissive on the Ramdisk​
Here, i explain how to implement in Ramdisk init.d and SELinux permissive.
We start from untouched kernel not bumped (so not from the kernel we eventually have bumped with the previous post).
Use @osmosis tool android image kitchen version for your system to unpack it.
After that, navigate to the AIK root folder and:
in split_img/boot.bin-cmdline, replace
Code:
console=ttyHSL0,115200,n8 user_debug=31 ehci-hcd.park=3 msm_rtb.filter=0x37 androidboot.hardware=g3
by
Code:
console=ttyHSL0,115200,n8 user_debug=31 ehci-hcd.park=3 msm_rtb.filter=0x37 androidboot.hardware=g3 androidboot.selinux=permissive
in ramdisk/init.qcom.rc replace
Code:
on property:sys.boot_completed=1
start qcom-post-boot
by
Code:
service sysinit /sbin/sysinit.sh
oneshot
class late_start
user root
group root
disabled
on property:sys.boot_completed=1
start qcom-post-boot
start sysinit
and on /sbin folder, add a file named "sysinit.sh" that contains this code:
Code:
#!/system/bin/sh
mount -o rw,remount /system
if [ ! -e /system/etc/init.d ]; then
mkdir /system/etc/init.d
chown -R root.root /system/etc/init.d
chmod -R 755 /system/etc/init.d
fi;
mount -o ro,remount /system
run-parts /system/etc/init.d/
/system/xbin/daemonsu --auto-daemon &
Note: This previous code on sysinit.sh is only for those who have run-parts installed (with busybox by example). Otherwise, for those who don't want to use run-parts, you can put the next one that don't need it:
Code:
#!/system/bin/sh
mount -o rw,remount /system
if [ ! -e /system/etc/init.d ]; then
mkdir /system/etc/init.d
chown -R root.root /system/etc/init.d
chmod -R 755 /system/etc/init.d
fi;
mount -o ro,remount /system
setenforce 0
FILES=/system/etc/init.d/*
for f in $FILES
do
$f
done
/system/xbin/daemonsu --auto-daemon &
Now you are ready to repack the kernel. Use AIK repackimg script for that. After repacking the kernel, you still have to sign it (Bump!).
For this last formality depending on the OS which you find yourself:
1) On Linux
put a file that you name as you want with sh ext(bump.sh should be a great idea ) on the AIK root folder, and chmod it 755.
On this file put the code above:
Code:
#!/bin/bash
printf '\x41\xA9\xE4\x67\x74\x4D\x1D\x1B\xA4\x29\xF2\xEC\xEA\x65\x52\x79' >> image-new.img
Save it, and now just drag and drop this file on a window terminal and valid. That's all
2) On Windows
Refer to the OP, i explained there how I bump on windows
3) On Phone
Refer to the OP, i explained there how I bump on the phone
Wow great, waiting for chapter 2
reserved
u25150 said:
Wow great, waiting for chapter 2
Click to expand...
Click to collapse
I feel that few people seem really passionate about what I say, if I refer to the answers
Also I'm going to focus on those who, like you, arise, and seem interested in this subject.
What specifically would you like to see some detail (what do you call "chapter two" ) ?
Duckscreen said:
reserved
Click to expand...
Click to collapse
Welcome, pleased to meet you
@6ril1 great work my freind
jac10000 said:
@6ril1 great work my freind
Click to expand...
Click to collapse
Hi my friend (not my freind, which is an advantage of German expression, ) , thank's, I assume that it is better to teach to fish than give fish, but perhaps this concept is it outdated ?
Could you making how to kexec hardboot patch Guide please
(for support Multirom)
Really nice work my friend !!!
In Linux, I just make my first bump boot thanks to you :good:
jac10000 said:
Really nice work my friend !!!
In Linux, I just make my first bump boot thanks to you :good:
Click to expand...
Click to collapse
You are welcome
And great thank's for having notify me my mistake about code i wrote in post 2 (class late_sart instead of class late_start )
Code is edited and correct now
Yeaah @6ril1 and my first bump boot with SELinux permissive
jac10000 said:
Yeaah @6ril1 and my first bump boot with SELinux permissive
Click to expand...
Click to collapse
LOL, thank's to have testing all of that i described in this thread, and for having mentioning me in private some others mistakes (unexpected one space inserted during copy-paste on the post 2 and one code tag not closed) . I have edited again with all that you find and now it should be correct
THANK'S again my friend
For windows user, new stuff added, i'll edit op with that too:
http://forum.xda-developers.com/showpost.php?p=63884919&postcount=716
Edit2: One more simple solution just added in OP
I have new-img but how do you use hex editor exactly? i can not figure it out. can u help with screenshots please?
I tried your tutorial (windows x64)(only bump no change in ramdisk) for 30c MM kernel but my phone wont boot(i don't have security error). Any ideas? Thank you!

[GUIDE] Make a kernel for G531F variant

So, I'm doing this tutorial due to the trial and error I got.
Prerequisites:
Ubuntu or any linux-based os with the right packages installed
Source code from the kernel
Backup of you boot partition
These tools here
Patience
1) The first thing you want to do is to do a backup of your boot partition.
Code:
adb shell
dd if=/dev/block/mmcblk0p9 of=/sdcard/boot.img
2) Download the source code from here, extract it and place it somewhere. I placed it in /home/fabio/Documentos/Kernel/sourcecode
3) Download a toolchain, I downloaded "aarch64-linux-android-4.8" from google and placed in "/home/<your username>/Documentos/Kernel/aarch64-linux-android-4.8"
4) Go to your kernel source code and find the file "Makefile", open it and change CROSS_COMPILE= to say the place where you stored the toolchain "/home/<your username>/Documentos/Kernel/aarch64-linux-android-4.8" + "/bin/aarch64-linux-android-"
5) Now that you are done setting up the stuff, open a console and navigate to your kernel source code root and type
Code:
make
make pxa1908_grandprimevelte_eur_defconfig
make -j#
# is the number of cores + 1
6) While that runs, go to where you stored those mkbootimg tools and unpack that boot.img you backed up
7) Once the kernel building is complete. Go to your kernel folder and navigate to arch/arm64/boot and copy the file "Image.gz"
8) Download bless or an Hex Editor of your liking and open the following files: boot.img (the original boot), Image.gz, boot.img-zImage.
Search on the "boot.img-zImage" for 1F 8B 08 and copy everything before then on your Image.gz place what you copied and save it as a different file otherwise it will fail to save.
9) Go to your mkbootimg folder and where you stored the unpacked files and build one boot.img with the following command
Code:
./mkbootimg --kernel image2.gz --ramdisk boot.img-ramdisk.gz --dt boot.img-dt --signature boot.img-signature -o boot2.img
10) Flash the boot2.img using any software you want!
THIS MIGHT NOT WORK! If it doesn't you can send me a DM! I will be retouching this post again and make it prettier adding pictures and stuff but for now I can't do much!
If you know a better way of doing this please say in the replies! I will be building a kernel for this device soon enough
RESERVED
Can you please upload link of custom kernel
I'm still trying to do a kernel with new features, but don't know what to add yet. Trying to make Init.d support without 3rd party apps!
EDIT1: I give up! My phone is too much trouble and since SAMSUNG doesn't care about it neither do I anymore! Try to build the kernel yourself and tweak it as you like! Make a script to automate this process to be easier! Good luck! Anything you need just say
Can you help this guy for porting kernel source code http://forum.xda-developers.com/grand-prime/general/developers-discussion-sm-g531f-custom-t3444598
fabiossilva21 said:
So, I'm doing this tutorial due to the trial and error I got.
Prerequisites:
Ubuntu or any linux-based os with the right packages installed
Source code from the kernel
Backup of you boot partition
Degas mkbootimg tools
Patience
1) The first thing you want to do is to do a backup of your boot partition.
Code:
adb shell
dd if=/dev/block/mmcblk0p9 of=/sdcard/boot.img
2) Download the source code from here, extract it and place it somewhere. I placed it in /home/fabio/Documentos/Kernel/sourcecode
3) Download a toolchain, I downloaded "aarch64-linux-android-4.8" from google and placed in "/home/fabio/Documentos/Kernel/aarch64-linux-android-4.8"
4) Go to your kernel source code and find the file "Makefile", open it and change CROSS_COMPILE= to say the place where you stored the toolchain "/home/fabio/Documentos/Kernel/aarch64-linux-android-4.8" + "/bin/aarch64-linux-android-"
5) Now that you are done setting up the stuff, open a console and navigate to your kernel source code root and type
Code:
make
make pxa1908_grandprimevelte_eur_defconfig
make -j#
# is the number of cores + 1
6) While that runs, go to where you stored degas-mkbootimg tools and unpack that boot.img you backed up
7) Once the kernel building is complete. Go to your kernel folder and navigate to arch/arm64/boot and copy the file "Image.gz"
8) Download bless (Hex Edit) and open the following files: boot.img (the original boot), Image.gz, boot.img-zImage.
Search on the "boot.img-zImage" for 1F 8B 08 and copy everything before then on your Image.gz place what you copied and save it as a different file otherwise it will fail to save.
9) Go to your degas-mkbootimg folder and where you stored the unpacked files and build one boot.img with the following command
Code:
./degas-mkbootimg --kernel image2.gz --ramdisk boot.img-ramdisk.gz --dt boot.img-dt --signature boot.img-signature -o boot2.img
10) Flash the boot2.img using any software you want!
THIS MIGHT NOT WORK! If it doesn't you can send me a DM! I will be retouching this post again and make it prettier adding pictures and stuff but for now I can't do much!
If you know a better way of doing this please say in the replies! I will be building a kernel for this device soon enough
Click to expand...
Click to collapse
i follow this step and build kernel after flash boot.img phone not booting
my boot.img size is 8.2MB (image.gz size 6.5MB) where stock size is 8MB
is problem with size?
sorry for my bad english
How did you flash the boot.img?
fabiossilva21 said:
How did you flash the boot.img?
Click to expand...
Click to collapse
using odin
What changes did you make to the kernel?
fabiossilva21 said:
What changes did you make to the kernel?
Click to expand...
Click to collapse
Add governors
Other setting same as stock
If i build with stock setting without any changes then kernel boot but if i change something then its stuck on Samsung logo
Sorry, I can't really help you... I no longer work with Grand prime... switched to a J5
fabiossilva21 said:
Sorry, I can't really help you... I no longer work with Grand prime... switched to a J5
Click to expand...
Click to collapse
Ok
Noice

Categories

Resources