Root on 4.3 dev discussion

Search This thread

MohammadAG

Inactive Recognized Developer
Sep 7, 2009
1,080
5,504
30
Jerusalem
mohammadag.xceleo.org
The kernel is the same as the stock one, only the ramdisk is changed. So performance issues aren't related to this.
The boot animation always stuttered for me in the first go, even on stock 4.2, when it replays it's fine.
 
  • Like
Reactions: Croc_X

paulomario77

Senior Member
Sep 14, 2010
74
13
Floripa
Samsung Galaxy Z Flip3
The kernel is the same as the stock one, only the ramdisk is changed. So performance issues aren't related to this.
The boot animation always stuttered for me in the first go, even on stock 4.2, when it replays it's fine.

Thanks for the response, and pardon my ignorance, but perhaps the C6943 kernel is different from the other models' ? The C6943 has digital TV, maybe there are other differences in hardware.

It's not just the boot animation that stutters, performance is so bad when the system is up that it's almost unusable.
 

RHBH

Senior Member
Apr 1, 2013
766
459
31
Sao Paulo
Thanks for the response, and pardon my ignorance, but perhaps the C6943 kernel is different from the other models' ? The C6943 has digital TV, maybe there are other differences in hardware.

It's not just the boot animation that stutters, performance is so bad when the system is up that it's almost unusable.

No, C6902, C6903, C6906 and C6943 have the same kernel.

Did you wiped cache, Dalvik and Applog?
 
Last edited:

paulomario77

Senior Member
Sep 14, 2010
74
13
Floripa
Samsung Galaxy Z Flip3
No, C6902, C6903, C6906 and C6943 have the same kernel.

Did you wiped cache, Dalvik and Applog?

Am I missing something? Please bear with me, I'm not a developer. I went to http://xdaforums.com/showthread.php?t=2469191 and downloaded 3 FTF's:

C6943 14.2.A.0.290 Generic BR 1276-7099_R2B, which is for my Brazilian model;
C6902 14.2.A.0.290 Generic IN 1277-2364
C6903 14.2.A.0.290 Central Europe 1276-4314_R1B

I extracted the kernel.sin file from each FTF and all 3 kernel.sin files are different from each other. Even the file sizes don't match.
 
Last edited:

RHBH

Senior Member
Apr 1, 2013
766
459
31
Sao Paulo
Am I missing something? Please bear with me, I'm not a developer. I went to http://xdaforums.com/showthread.php?t=2469191 and downloaded 3 FTF's:

C6943 14.2.A.0.290 Generic BR 1276-7099_R2B, which is for my Brazilian model;
C6902 14.2.A.0.290 Generic IN 1277-2364
C6903 14.2.A.0.290 Central Europe 1276-4314_R1B

I extracted the kernel.sin file from each FTF and all 3 kernel.sin files are different from each other. Even the file sizes don't match.

The kernel sources are the same for all of them, look at Sony Developer World, also you can look at the build time.

But if you're not happy with the kernels provided here, you can always download the kernel sources from Sony Developer World and compile your own kernel.

Sent from my Xperia Z1 using Tapatalk Pro
 
  • Like
Reactions: gregbradley

B1nny

XDA Portal Team / Retired Forum Moderator
May 18, 2008
1,131
850
I think I have discovered something interesting. See, when I flash one of the kernels of the OP I get full root access but the system performance is very bad. When I flash the FTF for my country but in flashtool I exclude everything but the kernel, performance returns to normal but /system becomes unwritable, as expected. However, when I flash back the kernel from the OP, boot, then power off and, instead of flashing the FTF, I flash kernel.sin EXTRACTED FROM THE FTF, performance remains poor. It looks like the problem is not in kernel.sin itself, but somewhere else.

Bearing this in mind, if someone could answer a few questions:

1) What does a kernel.img file (e.g. one of the files from the OP) contain? Only the kernel.sin or other files as well?

2) Can I extract from/convert an img file to a kernel.sin file?

3) If the answer above is true, can I replace the kernel.sin inside an FTF with the kernel.sin obtained from one of the img files from the OP?

I really have no clue what performance issues you're speaking of. I am running the stock kernel with TWRP baked in and I have no problems whatsoever. Everything works super smooth, just as smooth as it did when I had a locked bootloader, thus was running the stock Sony kernel.

What and where is the proof for the performance issues you're talking about?
 

paulomario77

Senior Member
Sep 14, 2010
74
13
Floripa
Samsung Galaxy Z Flip3
I really have no clue what performance issues you're speaking of. I am running the stock kernel with TWRP baked in and I have no problems whatsoever. Everything works super smooth, just as smooth as it did when I had a locked bootloader, thus was running the stock Sony kernel.

What and where is the proof for the performance issues you're talking about?

My device is a Brazilian C6943. Other people from Brazil are also reporting terrible performance when using one of the .img files from the OP. You don't even need a benchmark app to assert the poor performance. For instance just try to install an app from the Play Store, it takes ages. Intall the Xposed framework, takes ages. Apps that require root take a very long time just to trigger SU prompt. Etc. Oh, and now and then the phone produces an inexplainable short vibration.

The C6943 has digital TV support, wchich is something that sets it asside from other Z1 models.
 

Nagato Yuki

Senior Member
Mar 2, 2009
121
9
Hong Kong
Bearing this in mind, if someone could answer a few questions:

1) What does a kernel.img file (e.g. one of the files from the OP) contain? Only the kernel.sin or other files as well?

2) Can I extract from/convert an img file to a kernel.sin file?

3) If the answer above is true, can I replace the kernel.sin inside an FTF with the kernel.sin obtained from one of the img files from the OP?

1) boot.img = zImage of Kernel (board related) + RAM Disk + dt.img (board related)
kernel.sin would include the these directly with Sony digital signature for flashmode

2) You could extract out these files directly from Kernel.sin

But you cannot combine non-official's ones back to kernel.sin for xperia 2012/2013 phone, since you cannot signature the files. Then your Q3 would be never accomplished.

However, it should be easy to create the boot images for C6943. It may be done with just replacing RAM Disk to one with recovery.

Then the remaining issue is that, if I just wanna fix the remount /system in OS issue, would just comment out these in init.sony-platform.rc:

Code:
    # Enable Sony RIC
    mount securityfs securityfs /sys/kernel/security nosuid nodev noexec
    write /sys/kernel/security/sony_ric/enable 1

what about the remaining RIC service part? Should it be commented out also?
Code:
service ric /sbin/ric
    user root
    group root
    oneshot
    class main
 
Last edited:

B1nny

XDA Portal Team / Retired Forum Moderator
May 18, 2008
1,131
850
My device is a Brazilian C6943. Other people from Brazil are also reporting terrible performance when using one of the .img files from the OP. You don't even need a benchmark app to assert the poor performance. For instance just try to install an app from the Play Store, it takes ages. Intall the Xposed framework, takes ages. Apps that require root take a very long time just to trigger SU prompt. Etc. Oh, and now and then the phone produces an inexplainable short vibration.

The C6943 has digital TV support, wchich is something that sets it asside from other Z1 models.
I see, would it be possible to provide both a logcat and a dmesg from the kernel in the OP and the stock kernel while trying to install an app for example? If those logs show any unusual behaviour the kernel devs might be able to fix it. As of right now they would just have to do random guesses.

You can obtain a logcat by turning on USB debugging in the developer options in the settings application. Once that is done you can use these 2 commands to get a logcat and a dmesg.
Code:
adb logcat
adb shell dmesg
Then post the output here, as an attachment or on pastebin/pastie for example.
 
  • Like
Reactions: paulomario77

Nagato Yuki

Senior Member
Mar 2, 2009
121
9
Hong Kong
Thank you very much for your answers. Would it be too much to ask if you would point me to a thread/tutorial explaining how a boot image can be created? Bear in mind that I'm not a developer/programmer.
I'm not a developer, too :laugh:
I just managed to modify (without recompiling Kernel source code) the Ramdisk to disable RIC.
But you still need to know how to unpack and repack boot images :eek:
Since I am not a developer, I wanna anyone to correct my steps:

You could use FlashTool to extract out these files of your kernal.sin

Tool > SIN editor > select kernel.sin (you should just un-zip FTF to get kernel.sin)
Extract data, you could get kernel.elf
Then Extractors > ELF
you could get these files:

kernel.elf.Image (zImage of Kernel, you could rename it to zImage)
kernel.elf.ramdisk.gz (RAM Disk)
kernel.elf.3 ( you should rename it to dt.img)

replace the the RAM Disk with one include recovery and remount fix one.
(NOT the img in OP, you should get the RAM Disk image from these files)

then you pack them into boot.img with mkbootimg which mention in krabappel2548's work: Xperia Z1 kernel building instructions

the command for packaging boot image with Z1 4.3 would be
Code:
./mkbootimg --cmdline "androidboot.hardware=qcom user_debug=31 maxcpus=2 msm_rtb.filter=0x37 ehci-hcd.park=3 lpj=192598 dwc3.maximum_speed=high dwc3_msm.prop_chg_detect=Y vmalloc=400M" \
      --base 0x00000000 --kernel [B]zImage[/B] --ramdisk [B]ramdisk.img[/B] \
      --ramdisk_offset 0x02000000 -o boot.img --dt [B]dt.img[/B] --tags_offset 0x01E00000
The bold part would be the filename of parts.
 
  • Like
Reactions: paulomario77

B1nny

XDA Portal Team / Retired Forum Moderator
May 18, 2008
1,131
850
Sorry if I misunderstood, I have practically no experience whatsoever with adb. The first command displayed a "live" log, that could only be interrupted by Ctrl + C. The second command returned "klogctl: Operation not permitted". This was with the stock kernel.
Ah sorry.
By typing "adb logcat > text.txt" your screen won't say anything until you press ctrl + c. What it does in the background is create a file called "text.txt" and writes the output of "adb logcat" to that file. So you enter the command "adb logcat > text.txt" (you can name this file anything you want) and then try to install an app for example. When you're done you press ctrl + c and open the "text.txt" file. Now you see the output of the "adb logcat" command there, that is what we need.
As for dmesg, you should run adb as root. You can do this with the following command "adb root", that should restart the adb daemon on your phone as root. You do have to be rooted for this to work though. After that it should work fine. Also note that again you have you write the output of dmesg to a file as follows "adb shell dmesg > text.txt". I hope it helps!

Edit:
Don't forget to search through the outputs of either your logcats or dmesg files for personal information, email addresses, passwords, pins, names, whatever might be in there. Normally it shouldn't show that information, but who knows.
 
  • Like
Reactions: paulomario77

paulomario77

Senior Member
Sep 14, 2010
74
13
Floripa
Samsung Galaxy Z Flip3
As for dmesg, you should run adb as root. You can do this with the following command "adb root", that should restart the adb daemon on your phone as root. You do have to be rooted for this to work though. After that it should work fine. Also note that again you have you write the output of dmesg to a file as follows "adb shell dmesg > text.txt". I hope it helps!

adb root returns "adbd cannot run as root in production builds". This is with the stock kernel. ADB shell IS on SU's whitelist.
 
Last edited:

paulomario77

Senior Member
Sep 14, 2010
74
13
Floripa
Samsung Galaxy Z Flip3
Ah sorry.
By typing "adb logcat > text.txt" your screen won't say anything until you press ctrl + c. What it does in the background is create a file called "text.txt" and writes the output of "adb logcat" to that file. So you enter the command "adb logcat > text.txt" (you can name this file anything you want) and then try to install an app for example. When you're done you press ctrl + c and open the "text.txt" file. Now you see the output of the "adb logcat" command there, that is what we need.
As for dmesg, you should run adb as root. You can do this with the following command "adb root", that should restart the adb daemon on your phone as root. You do have to be rooted for this to work though. After that it should work fine. Also note that again you have you write the output of dmesg to a file as follows "adb shell dmesg > text.txt". I hope it helps!

Edit:
Don't forget to search through the outputs of either your logcats or dmesg files for personal information, email addresses, passwords, pins, names, whatever might be in there. Normally it shouldn't show that information, but who knows.

When booting up after flashing TWRP.img, Im greeted with the message: "com.android.phone has stopped".

Anyway, logcats are attached. I installed https://play.google.com/store/apps/details?id=com.gm.decolar.

When using the TWRP.img kernel, my phone vibrated several times during the Play Store installation.

I couldn't obtain a dmesg output using the stock kernel, see my earlier post. The attached dmesg file refers to the custom kernel, but was obtained after the Play Store installation had finished. Is it OK?

Thanks.
 

Attachments

  • logcat.zip
    164 KB · Views: 7
  • dmesg.txt
    131.5 KB · Views: 10
Last edited:

shteren

Senior Member
Jul 9, 2013
588
109
just a quick question, i have the TWRP kernel from the op, for my understanding those kernels are stock kernels with only sony RIC disabled.

what happens if i try to relock bootloader with one of those flashed? will i soft brick it?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    Edit 2:
    Kernels with recoveries:
    Unlocked bootloader required for any of these:

    CWM by @lzyllp http://xdaforums.com/showpost.php?p=48599313&postcount=48
    TWRP by @Desperanto86 http://xdaforums.com/showpost.php?p=48600227&postcount=60
    Philz by me: http://mohammadag.xceleo.org/public/Android/XperiaZ1/Philz_4.3_kernel.img

    These kernels have Sony RIC disabled at boot, so /system is always writable.

    After flashing with fastboot flash boot filename.img, boot intro recovery and flash this:
    SuperSU zip http://download.chainfire.eu/supersu

    Edit: Discussion moot, root works fine as per below :D
    Proof: Xperia Flip Settings on 4.3:
    yUQwXMxl.png


    As most of you know, rooting 4.3 isn't fully possible. While su and Superuser.apk can be installed through recovery, /system can't be mounted.

    Code:
    root@C6903:/ # mount -o rw,remount /system                                 
    mount: Operation not permitted

    A fix for that is to disable Sony's RIC kernel implementation.
    Code:
    root@C6903:/system # echo 0 > /sys/kernel/security/sony_ric/enable
    root@C6903:/system # mount -o rw,remount /system                               
    root@C6903:/system #

    This is enabled on boot in init.sony-platform.rc:
    Code:
        # Enable Sony RIC
        mount securityfs securityfs /sys/kernel/security nosuid nodev noexec
        write /sys/kernel/security/sony_ric/enable 1

    After all this is done, /system is writable:
    Code:
    root@C6903:/system # echo 123 > test
    root@C6903:/system # cat test
    123

    However, I still can't figure out why Xposed won't install, which is making me wonder if this all worked or not.
    Edit: Xposed works fine as per http://xdaforums.com/showpost.php?p=48484642&postcount=6846

    Xposed installs fine, it just doesn't work:
    Code:
    mohammad@mohammad-i5desktop:~/Downloads$ adb -d logcat | grep Xposed
    D/Xposed  (  355): Starting Xposed binary version 47, compiled for SDK 16
    D/Xposed  (  355): Phone: C6903 (Sony), Android version 4.3 (SDK 18)
    D/Xposed  (  355): ROM: 14.2.A.0.290
    I/Xposed  (  355): -----------------
    I/Xposed  (  355): Found new Xposed jar version, activating it
    I/Xposed  (  355): Added Xposed (/data/data/de.robv.android.xposed.installer/bin/XposedBridge.jar) to CLASSPATH.
    D/AndroidRuntime(  355): >>>>>> AndroidRuntime START de.robv.android.xposed.XposedBridge <<<<<<
    D/Xposed  (  355): Using structure member offsets for mode WITH_JIT
    I/Xposed  (  355): Found Xposed class 'de/robv/android/xposed/XposedBridge', now initializing
    I/Xposed  (  355): -----------------
    I/Xposed  (  355): Dec 17, 2013 5:01:53 PM UTC
    I/Xposed  (  355): Loading Xposed v42 (for Zygote)...
    I/Xposed  (  355): Errors during Xposed initialization
    I/Xposed  (  355): java.lang.NoSuchMethodError: android.app.ActivityThread#getTopLevelResources(java.lang.String,int,android.content.res.Configuration,android.content.res.CompatibilityInfo)#exact
    6
    http://www75.zippyshare.com/v/47299431/file.html kernel with root enabled and TWPR recovery
    THX @lzyllp for help!
    don't forget to install update supersu
    5
    For the second time today

    1) Upgrade to .290
    2) Unlock bootloader
    3) Flash one of the boot.img from the OP
    4) Enter recovery and flash the SuperSU.zip from the OP
    5) Done


    If you do not know how to any of these steps there are literally dozens of guides on the general/development section. Just look in the sticky threads
    5
    New boot.img
    Fix navigation touch button
    Fix backpack and restore
    http://www.mediafire.com/view/kb517bwvvpjk76t/boot.img