Bring kernel and ramdisk togehter... - Sony Xperia P, U, Sola, Go

Hi guys,
i tried to make my kernel for the xperia s since i have it
but every time i got early bootlooops (before kernel logo)
i tested to extract the stock kernel and repack it but bootloop...
Unpacked the elf file with flashtool
and repacked it with this command:
python mkelf.py -o kernel.elf [email protected] [email protected],ramdisk [email protected],rpm
Click to expand...
Click to collapse
in the folder i tried to repack are these files:
mkelf.py, zImage, ramdisk.img, RPM.bin
can some one tell me that went wrong?

Hi mericon, nice to see you in the S section
Have a read through http://forum.xda-developers.com/showthread.php?t=1729280 i was having the same problems, which turned out to be the way some of us were unpacking the kernel.sin
Championswimmer has a nice little script on his github which works too (also in that thread)

that could be the problem but found an other thing that could it be too
on ics i have change this:
python mkelf.py -o kernel.elf [email protected] [email protected]200000,ramdisk [email protected],rpm
to this:
python mkelf.py -o kernel.elf [email protected] [email protected]300000,ramdisk [email protected],rpm
and finaly it works now i can create my kernel and it boots so hopefuly we have the next nice ICS based kernel in a few days
btw thanks for your help

Related

Howto - unpack,change,repack boot.img

Hi, for those interested I wrote following steps (ubuntu 10.10 32b):
(based on excellent http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images )
I included compiled tools mkbootfs , mkbootimg and perl scripts unpack-bootimg.pl and repack-bootimg.pl.
Repack-bootimg.pl is edited and the needed parameters for our folio are included ([email protected] [email protected] vmalloc=192M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:122000:a00:800,linux:a0e00:1000:800,loader:300:400:800,mbr:700:200:800,system:900:20000:800,cache:20900:80000:800,misc:a0900:400:800,userdata:a1f00:80000:800 boardtype=PR)
1) unpack attachement mytools.tgz into your home, in your home the folder ~/mytools is created:
tar -xzf mytools.tgz
2) copy existing boot.img into ~/mytools (from foliomod update.zip)
3) ./unpack-bootimg.pl boot.img
- old kernel from boot.img is extracted: boot.img-kernel.gz
- content of contained ramdisk is extracted in folder: boot-img.ramdisk
4) copy new compiled kernel (zImage) into ~/mytools (from <source>/kernel/arch/arm/boot/zImage , you have to compile yourself with the weeds2000 quide http://forum.xda-developers.com/showthread.php?p=10331797#post10331797)
5) make all desired changes into ramdisk folder
6) repack new boot.img with a new kernel and changed ramdisk
./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img
7) new boot image is created as boot-new.img
8) if you want just to experiment, you can take any full foliomod dexter's update.zip (1.3d), put the new boot image inside instead original one.
It is possible to remove the other 2 images (recovery and system) if you want just to flash kernel. NOTE! But you have to remove the extrating command for recovery and system from update.zip/meta-inf/com/google/android/update-script.
p.s. Feel free to correct me, if something wrong with the steps. It's my first attempt to compile kernel
I am on FolioMod 1.3d and I use the kernel built without patches from http://tegramid.com/wiki/Main_Page(Full GPL source bundle including framework) for a day without problems. I had to do a full wipe. It's meant for testing, I don't say that kernel from source is better or worse.
Many thanks to Dexter because everything is based on his release, weeds2000 because of his kernel compile quide and tsh who placed the sources on the git and to all who try hacking our folio
thx for this, that 'll be usefull
thanks for the guide.
i have managed to do every thing up to the repack
when i type
Code:
perl repack-bootimg.pl boot.img-kernel.gz boot.img-ramdisk.gz boot.img
i get error
Code:
boot.img-ramdisk.gz Not a directory at repack-bootimg.pl line 13.
even though it is definatly in their. any idea how to get it to work?
You don't have to provide the folder instead of the packed Ramdisk-File!
Because this script is made doing changes in Ramdisk and kernel..
So you can change the scripts inside the boot.img-ramdisk folder and the script will repack and add it to the new boot.img!
permission denied
i have done everything as you said, but while using split_bootimg.pl i got "permission denied". please suggest me what to do?
1. Enable read/write permissions for that file.
2. Tobr, you made a mistake in repack-bootimg.pl. You forgot to add " ./ " before mkbootimg.
Jon2555 said:
1. Enable read/write permissions for that file.
2. Tobr, you made a mistake in repack-bootimg.pl. You forgot to add " ./ " before mkbootimg.
Click to expand...
Click to collapse
The script was downloaded from internet not written by me. And it worked for me just fine. I can not verify now that you are right (probably you are). If it works for you with ./ then either I can put fixed version for download for others (if there is anybody) or it can be here just as a notice for other users, if not working.
I have ./ defined in my path variable in my profile so that i don't need it.
eror when repack
tobr said:
Hi, for those interested I wrote following steps (ubuntu 10.10 32b):
(based on excellent http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images )
I included compiled tools mkbootfs , mkbootimg and perl scripts unpack-bootimg.pl and repack-bootimg.pl.
Repack-bootimg.pl is edited and the needed parameters for our folio are included ([email protected] [email protected] vmalloc=192M video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:122000:a00:800,linux:a0e00:1000:800,loader:300:400:800,mbr:700:200:800,system:900:20000:800,cache:20900:80000:800,misc:a0900:400:800,userdata:a1f00:80000:800 boardtype=PR)
1) unpack attachement mytools.tgz into your home, in your home the folder ~/mytools is created:
tar -xzf mytools.tgz
2) copy existing boot.img into ~/mytools (from foliomod update.zip)
3) ./unpack-bootimg.pl boot.img
- old kernel from boot.img is extracted: boot.img-kernel.gz
- content of contained ramdisk is extracted in folder: boot-img.ramdisk
4) copy new compiled kernel (zImage) into ~/mytools (from <source>/kernel/arch/arm/boot/zImage , you have to compile yourself with the weeds2000 quide http://forum.xda-developers.com/showthread.php?p=10331797#post10331797)
5) make all desired changes into ramdisk folder
6) repack new boot.img with a new kernel and changed ramdisk
./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img
7) new boot image is created as boot-new.img
8) if you want just to experiment, you can take any full foliomod dexter's update.zip (1.3d), put the new boot image inside instead original one.
It is possible to remove the other 2 images (recovery and system) if you want just to flash kernel. NOTE! But you have to remove the extrating command for recovery and system from update.zip/meta-inf/com/google/android/update-script.
p.s. Feel free to correct me, if something wrong with the steps. It's my first attempt to compile kernel
I am on FolioMod 1.3d and I use the kernel built without patches from http://tegramid.com/wiki/Main_Page(Full GPL source bundle including framework) for a day without problems. I had to do a full wipe. It's meant for testing, I don't say that kernel from source is better or worse.
Many thanks to Dexter because everything is based on his release, weeds2000 because of his kernel compile quide and tsh who placed the sources on the git and to all who try hacking our folio
Click to expand...
Click to collapse
hi
when do this in ubuntu 11.4
get eorr below
[email protected]:~/Desktop/untitled folder$ ./unpack-bootimg.pl boot.img
kernel written to boot.img-kernel.gz
ramdisk written to boot.img-ramdisk.cpio.gz
463 blocks
extracted ramdisk contents to directory boot.img-ramdisk/
[email protected]:~/Desktop/untitled folder$ ./repack-bootimg.pl zImage boot.img-ramdisk boot-new.img
gzip: folder/ramdisk-repack.cpio.gz: No such file or directory
sh: mkbootimg: not found
No such file or directory at ./repack-bootimg.pl line 21.
[email protected]:~/Desktop/untitled folder
can any one help me?
any tools for windows ?
nguyenhonganh said:
any tools for windows ?
Click to expand...
Click to collapse
Same request!
repack problem
Can somebody tell me is it possible to repack kernel and ramdisk using just hex editor? Without this scripts and unmkbootimg and mkbootimg. What does not work for me cos im using i9100 Philz root. I know how to unpack it and change init.rc and pack it back again. So can i just put my (kernel+ramdisk) ramdisk.cpio.gz file inside mmcblk0p5 in exac location. Will that work out? I dont know what this is doing:
mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x20000000
--cmdline 'no_console_suspend=1' -o new_boot.img
this address thing and cmdline but if i replace just ramdisk i dont need to set up addres again cos everything will be in same place. And one more question if something goes wrong can i boot to recovery or download mode?
New kernel copied itself to mmcblk0p5
and i have new CWM now. So it seems to me recovery is inside mmcblk0p5 as well and my phone never use mmcblk0p6
@tobr, I cannot open the archive of boot.img-kernel.gz. When I try to open it with terminal, it says: Not a valid gzip file. What to do?

how to change sony boot image?

any way to set own .jpeg or .png picture?
or change it in kernel?
Do u think this is the right place to ask questions...that too with a new thread? The boot image lies inside the kernel...and decompiling a kernel is a dev's expertise.
Sent from my Xperia neo V using XDA
get the boot.img, exract it, you'll get ramdisk. extract it too, you'll get logo.rle
convert it to png
make your changes
convert it back to rle
then place it back in ramdisk
repack boot.img
AND ITS HARD TO DO THIS ON WINDOWS, YOU NEED LINUX FOR THIS
Aarush said:
get the boot.img, exract it, you'll get ramdisk. extract it too, you'll get logo.rle
convert it to png
make your changes
convert it back to rle
then place it back in ramdisk
repack boot.img
AND ITS HARD TO DO THIS ON WINDOWS, YOU NEED LINUX FOR THIS
Click to expand...
Click to collapse
Thank you for the detailed instructions!
I try to unpack it with Cygwin but give me error
Code:
./extractboot: ./split_bootimg.pl: /usr/bin/perl: bad interpreter: Permission de nied
./extractboot: line 17: cpio: command not found
gzip: ../../boot.img-ramdisk.gz: No such file or directory
Because you need to install cpio
, xz for some too. The is a win exe for unpacking kernels around here some where
Sent from my Xperia Neo V using XDA
i have instal cpio and get this
Code:
$ ./extractboot boot.img
./extractboot: ./split_bootimg.pl: /usr/bin/perl: bad interpreter: Permission de nied
gzip: ../../boot.img-ramdisk.gz: No such file or directory
cpio: premature end of archive
The clue there is permission denied
.. .
Sent from my Xperia Neo V using XDA
mpiekp said:
The clue there is permission denied
.. .
Sent from my Xperia Neo V using XDA
Click to expand...
Click to collapse
so where ist the problem? what i got to do?
Learn about Unix file permissions. Also read the Sony kernel dev blog or your repackaged kernel won't boot
Sent from my Xperia Neo V using XDA

[Q] what`s worng with my boot.img

Hi~ I`m working with galaxy tab 10.1 korean version (SHW-M380W)
I`m trying to build kernel and I don`t have any idea to make boot.img and set on the tab.......
I downloaded kernel & android source from samsung opensource site and I build them all I fallowed the README instruction from samsung, but I used android prebuilt cross compiler (now I got zImage, ramdisk.img, system.img and more)
then I tried to make boot.img and
mkbootimg --kernel zImage --ramdisk ramdisk.img -o boot.img
Click to expand...
Click to collapse
I got boot.img
but........................
when I download with Odin, come up with operation failed
and On device, there are 2 messages with red
Fail to downloar [g|LNX] [Data:15360(.0) > Part:4096(/4096) ] (2kB unit)
Tegra_Nand_Write: Error to DownloadPartition_Odin![err:0xffffffff]
Click to expand...
Click to collapse
I can`t set my zImage to device... please advice what to search or do
solved...
I was packing tar file in windows 7
when I done it in linux.....
working...
OMG

[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

[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