[TOOL][2013-12-20][SS/DS] Combine CWM with ANY kernel and ramdisk

Search This thread

alvinhochun

Senior Member
Oct 3, 2010
175
202
Note: This tool requires a Linux environment to run. Tested only on Ubuntu 12.04

Please report any bugs that you found here!

This is a tool to pack CWM recovery with any kernel and ramdisk on Linux, for the Xperia M (and very likely the Xperia M Dual also, but you are advised to replace the kernel and ramdisk with the one for Xperia M Dual)

How to use:
  1. Extract the files to any location
  2. Place the kernel zimage as `workdir/kernel`
  3. Write the kernel command line to `workdir/cmdline`
  4. Place the ramdisk (must be in gzip format) as `workdir/boot/boot.gz`
  5. Run the script `cwm-packer`
  6. The boot image is created as `combined-boot.img`. Flash it with `fastboot flash boot combined-boot.img`

(For older versions before 2013-12-20 only) The kernel and ramdisk included is the stock C1905 kernel and ramdisk. CWM recovery is version 6.0.4.4 (same as this: http://xdaforums.com/showthread.php?t=2480556)

Download:
View attachment cwm-packer-xperia-m-2013-12-20.tar.gz

(For older versions before 2013-12-20 only) https://docs.google.com/file/d/0B1i7Q5Isuy2JUWM1ZHhKcWQwR3M/edit?usp=sharing

Source code:
The tool itself is a shell script, it is the source code itself.
The CWM recovery is built using the source code on this thread: http://xdaforums.com/showthread.php?t=2480556

(For older versions before 2013-12-20 only) The kernel and boot ramdisk is extracted from stock ROM.
Kernel source: https://github.com/alvinhochun/sony-xperia-m-kernel

Changelog:
2013-12-20
  • Updated to CWM 6.0.4.5
  • For whatever reason, mounting sdcard as USB storage now works.
  • Busybox mount now works like typical CWM
  • The kernel and boot ramdisk is not included
2013-10-19
  • Compiled with cm-10.2 sources, CWM 6.0.4.4
  • Major changes in partition table format to allow CWM 6.0.4.4
  • Allow mounting external USB storage (using OTG cable) so backup can be stored on USB flash drives
2013-10-15b
  • Fixed screen shift issue!
2013-10-15
  • Include the zimage of the stock kernel instead of the uncompressed kernel
2013-10-14
  • Updates init script
  • Recompiled recovery to use device-specific key mapping (camera focus key = back)

Notes: if anyone needs the older CWM 6.0.3.7 (2013-10-15b) for any reasons, you can find it in the "File" -> "Manage revisions" on Google Drive.
 
Last edited:

alvinhochun

Senior Member
Oct 3, 2010
175
202
it will be great you will build cwm for locked boot loader ..
we are waiting for that

I just thought of a possible way to boot to recovery without modifying ramdisk, so it should not be long till I have a working CWM for you all. :)

Update: I decided not to work on CWM for locked bootloader, sorry.

Sent from my Sony Xperia M (C1905)
 
Last edited:
  • Like
Reactions: moneylatentoi

alvinhochun

Senior Member
Oct 3, 2010
175
202
Sorry, no, this tool is only useful for unlocked bootloader. Most likely useful to kernel developers to integrate CWM to their kernel (technically the boot image).

I said I thought of a way to put CWM to locked bootloader, well it would be a hacky way, may be unstable, and I will need quite some time to get it working. I also need testers who are not afraid of reflashing to factory state.

Sent from my Sony Xperia M (C1905)
 
  • Like
Reactions: moneylatentoi

ansebovi

Senior Member
@alvinhochun
i m having error

ansebovi@UbuntuV13:~/cwm-packer$ '/home/ansebovi/cwm-packer/workdir/cmdline'
/home/ansebovi/cwm-packer/workdir/cmdline: line 1: androidboot.hardware=qcom: command not found

i m ending up on this error on ubuntu 13.10 x64
i did all kernel renaming.,boot.gz placing..but still having this..
so i tried ur old version which already having the kernel and boot.gz in it...still same error

please help me
 

alvinhochun

Senior Member
Oct 3, 2010
175
202
@alvinhochun
i m having error

ansebovi@UbuntuV13:~/cwm-packer$ '/home/ansebovi/cwm-packer/workdir/cmdline'
/home/ansebovi/cwm-packer/workdir/cmdline: line 1: androidboot.hardware=qcom: command not found

i m ending up on this error on ubuntu 13.10 x64
i did all kernel renaming.,boot.gz placing..but still having this..
so i tried ur old version which already having the kernel and boot.gz in it...still same error

please help me

Nobody tells you to execute the `cmdline` file. You are supposed to run `cwm-packer`.

Sent from my Sony Xperia M (C1905)
 
  • Like
Reactions: ansebovi

DanDare_77

Member
Apr 13, 2014
23
3
Hello,

I want to use the script to make the CWM recovery image but Im not sure how to get the kernel and ramdisk to use on script. Can anyone confirm if this process is right:

I copied kernel.sin from the ftf file, opened the file on flashtool under "tools->Sin editor->Extract data" this produced the file kernel.elf. Then using flashtool under "tools->extractors->elf" selected the kernel.elf file then pressed "unpack". After this process I ended with 2 files: "kernel.elf.Image" and "kernel.elf.ramdisk.gz".

These are the two files I can use with the script to produce the CWM recovery image? I guess the "kernel.elf.Image" contains the 2k header? Anyway, I can just use these files straight on the script and Im good to go?

Also Im not sure about the step n.3 on the instructions:

"3. Write the kernel command line to `workdir/cmdline`"

What you mean by "write the kernel command line" ?

Apreciate any clue on this!

[EDITED]

By the contents of 'wordir/cmdline' it seems it contains instructions for boot, so, no need to write anything but just use the provided 'cmdline' as it is? P.S. Im on Xperia M dual (C2004), but crossflashed a C1904 firmware on it.
 
Last edited:

DanDare_77

Member
Apr 13, 2014
23
3
Alright,

Everything went well using the files as I described.
I didn't found any CWM combined bootloader for the ROM I'm using (15.1.A.1.9) so I put it here attached in case it can be useful for someone in the future.

Thanks again for this script and CWM build !

[EDITED]
No, not much luck trying to upload the image, maybe cause Im a new user or something
 

dsultan

Member
Nov 1, 2006
10
2
building kernel from stock source

help me somebody please

i'm trying to build custom kernel for my xperia M dual

got sources from sony's website, doing build by guide

here is an error:

Code:
In file included from drivers/usb/gadget/android.c:51:0:
drivers/usb/gadget/f_qdss.c: In function 'qdss_bind_config':
drivers/usb/gadget/f_qdss.c:586:38: warning: argument to 'sizeof' in 'strncmp' call is the same expression as the second source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
error, forbidden warning: f_qdss.c:586
make[3]: *** [drivers/usb/gadget/android.o] Error 1
make[2]: *** [drivers/usb/gadget] Error 2
make[1]: *** [drivers/usb] Error 2
make: *** [drivers] Error 2
is it an NDK version issue?

I'm running:
Code:
make -j8 ARCH=arm CROSS_COMPILE=/home/dev/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_GNU_Linux/bin/arm-none-linux-gnueabi-
thanks
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    Note: This tool requires a Linux environment to run. Tested only on Ubuntu 12.04

    Please report any bugs that you found here!

    This is a tool to pack CWM recovery with any kernel and ramdisk on Linux, for the Xperia M (and very likely the Xperia M Dual also, but you are advised to replace the kernel and ramdisk with the one for Xperia M Dual)

    How to use:
    1. Extract the files to any location
    2. Place the kernel zimage as `workdir/kernel`
    3. Write the kernel command line to `workdir/cmdline`
    4. Place the ramdisk (must be in gzip format) as `workdir/boot/boot.gz`
    5. Run the script `cwm-packer`
    6. The boot image is created as `combined-boot.img`. Flash it with `fastboot flash boot combined-boot.img`

    (For older versions before 2013-12-20 only) The kernel and ramdisk included is the stock C1905 kernel and ramdisk. CWM recovery is version 6.0.4.4 (same as this: http://xdaforums.com/showthread.php?t=2480556)

    Download:
    View attachment cwm-packer-xperia-m-2013-12-20.tar.gz

    (For older versions before 2013-12-20 only) https://docs.google.com/file/d/0B1i7Q5Isuy2JUWM1ZHhKcWQwR3M/edit?usp=sharing

    Source code:
    The tool itself is a shell script, it is the source code itself.
    The CWM recovery is built using the source code on this thread: http://xdaforums.com/showthread.php?t=2480556

    (For older versions before 2013-12-20 only) The kernel and boot ramdisk is extracted from stock ROM.
    Kernel source: https://github.com/alvinhochun/sony-xperia-m-kernel

    Changelog:
    2013-12-20
    • Updated to CWM 6.0.4.5
    • For whatever reason, mounting sdcard as USB storage now works.
    • Busybox mount now works like typical CWM
    • The kernel and boot ramdisk is not included
    2013-10-19
    • Compiled with cm-10.2 sources, CWM 6.0.4.4
    • Major changes in partition table format to allow CWM 6.0.4.4
    • Allow mounting external USB storage (using OTG cable) so backup can be stored on USB flash drives
    2013-10-15b
    • Fixed screen shift issue!
    2013-10-15
    • Include the zimage of the stock kernel instead of the uncompressed kernel
    2013-10-14
    • Updates init script
    • Recompiled recovery to use device-specific key mapping (camera focus key = back)

    Notes: if anyone needs the older CWM 6.0.3.7 (2013-10-15b) for any reasons, you can find it in the "File" -> "Manage revisions" on Google Drive.
    5
    I have updated this tool with CWM 6.0.4.4.
    1
    it will be great you will build cwm for locked boot loader ..
    we are waiting for that
    1
    it will be great you will build cwm for locked boot loader ..
    we are waiting for that

    I just thought of a possible way to boot to recovery without modifying ramdisk, so it should not be long till I have a working CWM for you all. :)

    Update: I decided not to work on CWM for locked bootloader, sorry.

    Sent from my Sony Xperia M (C1905)
    1
    @alvinhochun
    i m having error

    ansebovi@UbuntuV13:~/cwm-packer$ '/home/ansebovi/cwm-packer/workdir/cmdline'
    /home/ansebovi/cwm-packer/workdir/cmdline: line 1: androidboot.hardware=qcom: command not found

    i m ending up on this error on ubuntu 13.10 x64
    i did all kernel renaming.,boot.gz placing..but still having this..
    so i tried ur old version which already having the kernel and boot.gz in it...still same error

    please help me

    Nobody tells you to execute the `cmdline` file. You are supposed to run `cwm-packer`.

    Sent from my Sony Xperia M (C1905)