Jump to content

64 Bit kernel compiling


Guest Nonta72

Recommended Posts

Guest Nonta72

I have got my Blade S6 3 days ago and I'm enjoying it.

The ONLY thing I'm hating is that the device is shipped with a 32 bit OS, 32 bit kernel and sadly a 32 bit kernel source code.

I've been trying to compile a 64 bit kernel (and then a 64 bit cm12.1) but I'm getting some errors related to the Assembler.

Since there's no defconfig related to the device in its kernel source, I used the posted by @KonstaT here

I put it in kernel/arch/arm64/defconfig

I used this toolchain https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8/

Here's the error log

  CC      drivers/devfreq/governor_msm_adreno_tz.o
  CC      drivers/devfreq/bimc-bwmon.o
  CC      drivers/devfreq/armbw-pm.o
/tmp/cc51NIk4.s: Assembler messages:
/tmp/cc51NIk4.s:21: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,3'
/tmp/cc51NIk4.s:32: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,1'
/tmp/cc51NIk4.s:56: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,2'
/tmp/cc51NIk4.s:80: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c14,1'
/tmp/cc51NIk4.s:104: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c14,2'
/tmp/cc51NIk4.s:128: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c13,2'
/tmp/cc51NIk4.s:160: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,0'
/tmp/cc51NIk4.s:172: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,5'
/tmp/cc51NIk4.s:184: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c13,1'
/tmp/cc51NIk4.s:195: Error: unknown mnemonic `mcr' -- `mcr p15,0,x1,c9,c13,2'
/tmp/cc51NIk4.s:272: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c14,1'
/tmp/cc51NIk4.s:285: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,3'
/tmp/cc51NIk4.s:296: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,1'
/tmp/cc51NIk4.s:334: Error: unknown mnemonic `mcr' -- `mcr p15,0,x1,c9,c12,2'
/tmp/cc51NIk4.s:345: Error: unknown mnemonic `mrc' -- `mrc p15,0,x2,c9,c13,2'
/tmp/cc51NIk4.s:984: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,2'
/tmp/cc51NIk4.s:995: Error: unknown mnemonic `mrc' -- `mrc p15,0,x0,c9,c13,2'
/tmp/cc51NIk4.s:1013: Error: unknown mnemonic `mrc' -- `mrc p15,0,x2,c9,c13,2'
/tmp/cc51NIk4.s:1024: Error: unknown mnemonic `mrc' -- `mrc p15,0,x0,c9,c12,3'
/tmp/cc51NIk4.s:1149: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c14,1'
/tmp/cc51NIk4.s:1162: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,3'
/tmp/cc51NIk4.s:1173: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,1'
/tmp/cc51NIk4.s:1678: Error: unknown mnemonic `mcr' -- `mcr p15,0,x0,c9,c12,2'
/tmp/cc51NIk4.s:1694: Error: unknown mnemonic `mrc' -- `mrc p15,0,x1,c9,c13,2'
/tmp/cc51NIk4.s:1705: Error: unknown mnemonic `mrc' -- `mrc p15,0,x3,c9,c12,3'
scripts/Makefile.build:308: recipe for target 'drivers/devfreq/armbw-pm.o' failed
make[2]: *** [drivers/devfreq/armbw-pm.o] Error 1
scripts/Makefile.build:455: recipe for target 'drivers/devfreq' failed
make[1]: *** [drivers/devfreq] Error 2
Makefile:815: recipe for target 'drivers' failed
make: *** [drivers] Error 2
nonta72@HaswellGT2:~/kernel$ 

The advantage of a 64 bit kernel are not mainstream! From performance increase to ported roms ;) Currently most devices I found with msm8939 are running 64 bit OS. It's pretty easy to port roms if both devices have 64 bit kernel.

Your help is welcome.

 

Note: I have already tried other toolchains (UBERTC, aarch64-android-linux-4.9 in the ndk), it's the same error.

Link to comment
Share on other sites

Guest KonstaT

Sorry, I don't see the point in wasting effort on this. Sure, as a proof of concept but you're not going to see any real world benefits. Running 64-bit kernel and 32-bit userspace is possible AFAIK, but I'd expect you to run into all kinds of trouble with this. 32-bit kernel doesn't prevent you from porting any ROM in the world either (=building from source - you shouldn't use 'winzip' to do it anyway). In any case, you'll still be missing 64-bit device specific proprietary binary drivers because ZTE has never released a 64-bit Android build for this device.

Simply copying defconfig to another directory doesn't make it arm64 compatible. You need to change quite a few options for that (CONFIG_ARM -> CONFIG_ARM64, and so on). Might be easier to start with the generic defconfig where ZTE has made their changes (one of the msm8916_defconfig ones) and let menuconfig generate it for arm64.

Edited by KonstaT
Link to comment
Share on other sites

Guest Nonta72
Just now, KonstaT said:

Sorry, I don't see the point in wasting effort on this. Sure, as a proof of concept but you're not going to see any real world benefits. Running 64-bit kernel and 32-bit userspace is possible AFAIK, but I'd expect you to run into all kinds of trouble with this. 32-bit kernel doesn't prevent you from porting any ROM in the world either (=building from source - you shouldn't use 'winzip' to do it anyway). In any case, you'll still be missing 64-bit device specific proprietary binary drivers because ZTE has never released a 64-bit Android build for this device.

Hi,

I'm not exactly trying to run 64bit kernel in 32 bit userspace. I'm trying to compile a 64 bit kernel so that I can boot 64 bit roms. If you go here http://forums.yuplaygod.com/forums/Development you can seen the number of roms available (from compiled roms to ported ones). All of them are 64 bit except KitKat builds.

Thus, any port from one of these roms will ultimately fail to boot until proper patching has been made. Patching can be done to system itself to make it 32 bit (a sort of conversion), but I can't do that because I've no idea how such thing should be done.

Just now, KonstaT said:

Simply copying defconfig to another directory doesn't make it arm64 compatible. You need to change quite a few options for that (CONFIG_ARM -> CONFIG_ARM64, and so on). Might be easier to start with the generic defconfig where ZTE has made their changes (one of the msm8916_defconfig ones) and let menuconfig generate it for arm64.

Well, I have compared the .config file generated (after using 'make ARCH=arm64 blade_defconfig') to Yureka's defconfig; the options you suggested were automatically added with few more changes.

I have already made out a kernel but I get stuck on bootlogo. Since I used 'make ARCH=arm64 -j4' to compile, the kernel came with 'Image.gz' format instead of zImage. I have no idea how to get zImage from that file and then put it inside the boot.img within ramdisk. I have tried few options for that like renaming it to 'bootimg-kernel' or extracting the 'Image' file inside it (Yes! there's a file called Image inside the Image.gz file). Both scenarios led nothing.

 

Thank you!

Link to comment
Share on other sites

Guest KonstaT

Vast majority of those ROMs is built from source (and more or less based on CyanogenMod) and there's nothing stopping you from building those ROMs in 32-bit. You're still missing the 64-bit proprietary blobs for this device. Do you know devices where this has been done before? I'm not aware of any. Quite a few vendors (e.g. Motorola, Alcatel) ship 32-bit builds on their msm8916/msm8939 devices.

Are building the kernel standalone or as a part of a CM build? Check BoardConfig.mk on some 64-bit device (e.g. that yu tomato) and see what flags you need to change for 64-bit kernel build.

Link to comment
Share on other sites

Guest Nonta72
Just now, KonstaT said:

Vast majority of those ROMs is built from source (and more or less based on CyanogenMod) and there's nothing stopping you from building those ROMs in 32-bit. You're still missing the 64-bit proprietary blobs for this device. Do you know devices where this has been done before? I'm not aware of any. Quite a few vendors (e.g. Motorola, Alcatel) ship 32-bit builds on their msm8916/msm8939 devices.

Well, that's kinda obvious! They're built from source, but most of them (beside CM and derivatives) don't have source available for public i.e OEM custom skin roms such as Coolpad's Cool UI, Meizu's Flyme or Oppo's ColorOS. I have no problem with compiling them myself, just need the source.

Just now, KonstaT said:

Are building the kernel standalone or as a part of a CM build? Check BoardConfig.mk on some 64-bit device (e.g. that yu tomato) and see what flags you need to change for 64-bit kernel build.

I'm compiling a standalone kernel.

Link to comment
Share on other sites

Guest KonstaT

And why would anyone want a horrible closed source OEM skin?! That's the first thing people usually want to get rid off. And I'm sure Coolpad, Meizu and Oppo have released plenty 32-bit builds you can winzip all you want. You don't necessarily need to 'port' ROMs from YU Yureka (or whatever), you know...

I'm past my winzip'ing days and I don't find this even remotely interesting. Good luck with your effort anyway.

Link to comment
Share on other sites

Guest Nonta72
Just now, KonstaT said:

And why would anyone want a horrible closed source OEM skin?! That's the first thing people usually want to get rid off. And I'm sure Coolpad, Meizu and Oppo have released plenty 32-bit builds you can winzip all you want. You don't necessarily need to 'port' ROMs from YU Yureka (or whatever), you know...

I'm past my winzip'ing days and I don't find this even remotely interesting. Good luck with your effort anyway.

I think I've been misunderstood!

Talking about OEM custom skins was just an example to tell you that we don't always have source code of all roms.

I'm compiling this kernel for two things:

- To improve device performance

- To install MIUI 7 Lollipop from Mi4i ;)

 

Thank you for your answers, guess I will have to find out myself.

Link to comment
Share on other sites

Guest KonstaT

I just can't understand your reasons.

There's little to gain what comes to performance. That's totally irrelevant when your main concern is to still have all the hardware working. Bootloader might play some role in this too and it might not even be possible to boot 64-bit kernel in the first place.

I'm sure there's plenty of 32-bit MIUI7 builds (and MIUI patchROM) so there's no reason why you would need to port it from Mi4i. There's not a single ROM in the world you'd need a 64-bit kernel for.

Let me know if you get this done, I'd be interested to know. I'm quite sure you'd be the first in the world to do this. :)

Edited by KonstaT
Link to comment
Share on other sites

Guest Nonta72
6 hours ago, KonstaT said:

I just can't understand your reasons.

There's little to gain what comes to performance. That's totally irrelevant when your main concern is to still have all the hardware working. Bootloader might play some role in this too and it might not even be possible to boot 64-bit kernel in the first place.

I'm sure there's plenty of 32-bit MIUI7 builds (and MIUI patchROM) so there's no reason why you would need to port it from Mi4i. There's not a single ROM in the world you'd need a 64-bit kernel for.

Let me know if you get this done, I'd be interested to know. I'm quite sure you'd be the first in the world to do this. :)

Bootloader part is probably true!

But I can only port roms if chipsets are same, all MIUI lollipop roms I found for msm8939 are 64 bit.

What did you mean by 'There's not a single ROM in the world you'd need a 64-bit kernel for.' ?

All I know is that when I try to boot a 64 bit rom, device just go into reboot loop. I for example tried to port ZTE Nubia Z9 Mini ROM (which currently runs fine on YU Yureka) and it failed just like any other 64 bit rom.

Lastly, I gave up on doing this. My knowledge in kernel are VERY mainstream to accomplish something even legends didn't accomplish in the word :) According to what you just said in the last line, there not a single chance to get a 64 bit kernel on this device.

 

Thank you for your replies.

Edited by Nonta72
Link to comment
Share on other sites

Guest KonstaT

I meant that you can find a 32-bit build on pretty much any ROM (or you can build one yourself when the source code is available). It's not true that you can only port ROMs if the chipsets are the same either - it's architecture that matters. E.g. Android SDK emulator image usually gets ported to few devices when new major Android version is released (there's generic arm and x86 images available). 

Well, I'm not the person you should be asking about winzip porting and I've already stated my opinion that I don't consider it worthwhile. :P

Link to comment
Share on other sites

Guest Nonta72
On 2/5/2016 at 6:02 PM, KonstaT said:

I meant that you can find a 32-bit build on pretty much any ROM (or you can build one yourself when the source code is available). It's not true that you can only port ROMs if the chipsets are the same either - it's architecture that matters. E.g. Android SDK emulator image usually gets ported to few devices when new major Android version is released (there's generic arm and x86 images available). 

Well, I'm not the person you should be asking about winzip porting and I've already stated my opinion that I don't consider it worthwhile. :P

I can confirm that we need a source code from ZTE with 64 bit support. I have compiled a whole cm12.1 rom (including boot.img) with aarch64 arch but it failed to boot.

About the architecture matter, isn't there a big different between arm and arm64 ?

 

BTW, I managed to made patchrom of FlymeOS lollipop but SIM Card isn't detected and Camera isn't working. I'll try to fix those bugs and will upload the rom.

Thank you.

 

Edit:

I found this, https://github.com/KonstaT/android_kernel_zte_msm8916/blob/cm-12.1/arch/arm64/configs/msm_P839F30_defconfig

Can I have hope ?

I know that the Ultra 6 is different from Blade S6, but if it gets a 64 bit kernel source, it should be possible to port it to the Blade S6 :p

Edited by Nonta72
Link to comment
Share on other sites

Guest KonstaT

It's the ARMv7->ARMv8 leap (and new instructions and improvements it brings) that's more significant than something being 32-bit or 64-bit.

Kernel source should be just fine. Basically you could build it for any architecture with the right toolchain to cross compile. There's no specific 64-bit kernel source. E.g. Alcatel msm8939/msm8916 devices use the same kernel source, Idol 3 5.5" builds 64-bit - Idol 3 4.7" builds 32-bit. You can compare that defconfig to the one with the same name in arm/configs and see the changes. It might help you generate an arm64 defconfig for your device, that's all.

Like said, you're still missing the 64-bit device specific proprietary binary drivers for Android. Bootloader might be an even bigger issue.

Edited by KonstaT
Link to comment
Share on other sites

Guest Nonta72
1 hour ago, KonstaT said:

It's the ARMv7->ARMv8 leap (and new instructions and improvements it brings) that's more significant than something being 32-bit or 64-bit.

Kernel source should be just fine. Basically you could build it for any architecture with the right toolchain to cross compile. There's no specific 64-bit kernel source. E.g. Alcatel msm8939/msm8916 devices use the same kernel source, Idol 3 5.5" builds 64-bit - Idol 3 4.7" builds 32-bit. You can compare that defconfig to the one with the same name in arm/configs and see the changes. It might help you generate an arm64 defconfig for your device, that's all.

Like said, you're still missing the 64-bit device specific proprietary binary drivers for Android. Bootloader might be an even bigger issue.

I think you're entirely right on the bootloader part!

I used to blindly flash BQ Aquaris M5 cm12.1 builds on my device just to see what happens, all of the cm12.1 builds used to boot fine. But recently a cm13 build has been released and it requires an updated bootloader on the M5 (latest 3.2.2 firmware update); I flashed that cm13 on my phone but it didn't boot. Maybe the new bootloader includes a new settings for the M5 bootloader. However, I'm making few commits to my kernel source so that I can recompile cm13 using blade s6's files, hope that makes it boot.

So yes, I believe our bootloader is built to just boot just 32 bit kernels and roms.

Let's hope ZTE releases 64 bit proprietary files for at least one of the S6 variants or VSU6!

 

~ Thank you ~

Link to comment
Share on other sites

  • 8 months later...
Guest innfinite4evr

Hi @Nonta72
I have  the same problem like you.....that is having a 32 bit os armv7 on  a  64 bit arm64 capable device.......

I feel sad whenever I download a ROM to port and it comes out 64 bit........

Btw, I was able to boot miui on 32 bit msm8939.........I need your help in bug fixing .....

Kindly ping me

@innfinite4evr              on telegram           

 

 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.