[DEV] Porting kernel 3.10.x to d2 for Lollipop

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,116
0
As we know, Android Lollipop is being released soon, and it requires a kernel that is 3.10.y, which is not available for our device. I'm not great with kernels and would in no way consider myself a kernel developer, but I have applied the neccessary patches to get the kernel version up to 3.10.0, which can be found here https://github.com/frap129/android_kernel_samsung_d2. Because I'm not a kernel developer, I am looking for some help in at least getting this kernel somewhat ready before the release of 5.0, so we can all get the latest update ASAP. Any and all help is apreciated!
 

Ivan_Meler

Recognized Developer
Apr 24, 2012
1,301
16,912
153
Vukovar
As we know, Android Lollipop is being released soon, and it requires a kernel that is 3.10.y, which is not available for our device. I'm not great with kernels and would in no way consider myself a kernel developer, but I have applied the neccessary patches to get the kernel version up to 3.10.0, which can be found here https://github.com/frap129/android_kernel_samsung_d2. Because I'm not a kernel developer, I am looking for some help in at least getting this kernel somewhat ready before the release of 5.0, so we can all get the latest update ASAP. Any and all help is apreciated!
nope android 5.0 doesnt require new kernel, you could build it on 3.0.y like i am doing on my Note 2 oh and as far as i know new nexus devices are still on 3.4.y
 
Last edited:

ztotherad

Senior Member
Aug 17, 2011
2,784
616
193
Illinois
nope android 5.0 doesnt require new kernel, you could build it on 3.0.y like i am doing on my Note 2 oh and as far as i know new nexus devices are still on 3.4.y
yes, but the new Samsung tablets (at least) are being shipped with the 3.10.x kernels.. 'course they're still running kitkat at the moment, but definitely cannot wait to see if/when they get kit kat.

I'll have to report back later after I take pictures of the 'about phone' page lol [if you want proof anyway]
 

Ivan_Meler

Recognized Developer
Apr 24, 2012
1,301
16,912
153
Vukovar
As we know, Android Lollipop is being released soon, and it requires a kernel that is 3.10.y, which is not available for our device. I'm not great with kernels and would in no way consider myself a kernel developer, but I have applied the neccessary patches to get the kernel version up to 3.10.0, which can be found here https://github.com/frap129/android_kernel_samsung_d2. Because I'm not a kernel developer, I am looking for some help in at least getting this kernel somewhat ready before the release of 5.0, so we can all get the latest update ASAP. Any and all help is apreciated!
yes, but the new Samsung tablets (at least) are being shipped with the 3.10.x kernels.. 'course they're still running kitkat at the moment, but definitely cannot wait to see if/when they get kit kat.

I'll have to report back later after I take pictures of the 'about phone' page lol [if you want proof anyway]
I know samsung does things like that (i have few other devices from them) but hey thats samsung and they are lazy so they dont want to update kernel version after device is relesed so they do this not to feel outdated on softwere side
 

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,116
0
Whoops! I read somewhere that the newly expanded SELinux permissions had some dependency on the 3.10.y kernel. Oh well, I guess Ill just test it anyways so I can brag that I have a newer kernel than anyone else if it works ;)
 

polarEskimo

Senior Member
Jun 3, 2011
50
4
0
Rochester
Whoops! I read somewhere that the newly expanded SELinux permissions had some dependency on the 3.10.y kernel. Oh well, I guess Ill just test it anyways so I can brag that I have a newer kernel than anyone else if it works ;)
That would definitely be awesome! Be sure to report back your results. I'm not an experienced ROM or kernel developer, but I'll be attempting on bringing a pure AOSP 5.0.0_r2 to my GS3. I'm not sure how successful I'll be, but my first step involved me planning on copying over our vendor repo from CM's M11 or M12 release (whenever that gets out) and trying to build Lollipop against it.
 

frap129

Inactive Recognized Developer
Jan 6, 2013
1,392
4,116
0
That would definitely be awesome! Be sure to report back your results. I'm not an experienced ROM or kernel developer, but I'll be attempting on bringing a pure AOSP 5.0.0_r2 to my GS3. I'm not sure how successful I'll be, but my first step involved me planning on copying over our vendor repo from CM's M11 or M12 release (whenever that gets out) and trying to build Lollipop against it.
I was planning on working on that as well over the weekend.
 

Ivan_Meler

Recognized Developer
Apr 24, 2012
1,301
16,912
153
Vukovar
That would definitely be awesome! Be sure to report back your results. I'm not an experienced ROM or kernel developer, but I'll be attempting on bringing a pure AOSP 5.0.0_r2 to my GS3. I'm not sure how successful I'll be, but my first step involved me planning on copying over our vendor repo from CM's M11 or M12 release (whenever that gets out) and trying to build Lollipop against it.
You will need to change many things in device tree to get it compile oh and dont forget to disable cm overlays
 

polarEskimo

Senior Member
Jun 3, 2011
50
4
0
Rochester
You will need to change many things in device tree to get it compile oh and dont forget to disable cm overlays
I'm very new to the AOSP build process and didn't have much luck last night getting the CM device sources to play nicely with AOSP. I'm finding it difficult to find any relevant guides on porting over the CM device trees to pure AOSP. If you or anyone else can help by explaining the process or pointing to a guide that I may have missed, I'd be grateful. Plus the more people we have collaborating on his, the better our chances of getting Lollipop on our devices.
 
  • Like
Reactions: Dariste

Restl3ss

Senior Member
Aug 3, 2013
633
1,075
0
Fort Mcmurray
I'm working on porting 5.0 to our phone, tweaked the device tree and got the build running but (as expected) i'm running into SEpolicy hell. The new selinux implementation in lollipop is proving to be trouble. I've just made a few more edits and the build is moving along, I'll post results shortly.

If anyone cares to help I'll walk you through what I've done so far. One thing to note is you need to adjust vendorsetup.sh to say full_d2lte-eng instead of cm_d2lte-eng and create AndroidProducts.mk that points at full_d2lte.mk (you can use the hammerhead device tree as a reference to do this)

That will get your device tree to regester properly. If you don't do the above you'll get a "no config makefile found" error when you try to select d2lte with lunch.

As far as the actual tree, you're gonna wanna grab device/samsung/d2lte, device/samsung/msm8960-common, vendor/samsung/d2lte, vendor/samsung/msm8960-common, vendor/cm, vendor/cyngn, and kernel/d2.

You'll also need a couple things from /hardware, namely hardware/samsung. There's a couple things you'll need to remove from msm8960-common in /device, I can't remember the specific file name but the error message will tell you.

Follow those instructions and you'll get where I'm at, with the build crapping out on SEpolicy
 
Last edited:

polarEskimo

Senior Member
Jun 3, 2011
50
4
0
Rochester
I'm working on porting 5.0 to our phone, tweaked the device tree and got the build running but (as expected) i'm running into SEpolicy hell. The new selinux implementation in lollipop is proving to be trouble. I've just made a few more edits and the build is moving along, I'll post results shortly.

If anyone cares to help I'll walk you through what I've done so far. One thing to note is you need to adjust vendorsetup.sh to say full_d2lte-eng instead of cm_d2lte-eng and create AndroidProducts.mk that points at full_d2lte.mk (you can use the hammerhead device tree as a reference to do this)

That will get your device tree to regester properly. If you don't do the above you'll get a "no config makefile found" error when you try to select d2lte with lunch.

As far as the actual tree, you're gonna wanna grab device/samsung/d2lte, device/samsung/msm8960-common, vendor/samsung/d2lte, vendor/samsung/msm8960-common, vendor/cm, vendor/cyngn, and kernel/d2.

You'll also need a couple things from /hardware, namely hardware/samsung. There's a couple things you'll need to remove from msm8960-common in /device, I can't remember the specific file name but the error message will tell you.

Follow those instructions and you'll get where I'm at, with the build crapping out on SEpolicy
Wow, this is awesome. It sounds like you've gotten the furthest than any of us. I appreciate the instructions, but is there any chance you could push your repos to GitHub? And do you think the SELinux stuff you're running into has anything to do with our device being on the 3.4 kernel instead of 3.10?
 

Restl3ss

Senior Member
Aug 3, 2013
633
1,075
0
Fort Mcmurray
Wow, this is awesome. It sounds like you've gotten the furthest than any of us. I appreciate the instructions, but is there any chance you could push your repos to GitHub? And do you think the SELinux stuff you're running into has anything to do with our device being on the 3.4 kernel instead of 3.10?
It's not a kernel thing so much as a device tree thing. (Kitkat vs lollipop) the policy.conf (along with a few other things) in the device tree is designed for kitkat and isn't playing very nice with the 5.0 source. I'm trying to bang it out a bit by swapping a few C and header files in the build core.

As for my last build, my tweaks got me past where I was but now I'm hanging on a new set of SElinux errors.

I've been at this for less than 12 hours so given that timeframe this looks promising.

I'm trying to think of what the best way to go about this is. I could either try to adapt the tree for the new source or I could try to adapt the source for the old tree (use KitKat SElinux implementation on lollipop). The latter would have more success with root but the former is the correct way to do it (and would get us cyanogenmod 12 faster once they start nightlies, as I can push the changes to gerrit)
 
Last edited:
  • Like
Reactions: lucaoldb

polarEskimo

Senior Member
Jun 3, 2011
50
4
0
Rochester
It's not a kernel thing so much as a device tree thing. (Kitkat vs lollipop) the policy.conf (along with a few other things) in the device tree is designed for kitkat and isn't playing very nice with the 5.0 source. I'm trying to bang it out a bit by swapping a few C and header files in the build core.

As for my last build, my tweaks got me past where I was but now I'm hanging on a new set of SElinux errors.

I've been at this for less than 12 hours so given that timeframe this looks promising.

I'm trying to think of what the best way to go about this is. I could either try to adapt the tree for the new source or I could try to adapt the source for the old tree (use KitKat SElinux implementation on lollipop). The latter would have more success with root but the former is the correct way to do it (and would get us cyanogenmod 12 faster once they start nightlies, as I can push the changes to gerrit)
Again, any chance you can post your source? You don't have to try and work on it on your own. The more people that look at the progressions you made, the better our chances are at success.
 

Ivan_Meler

Recognized Developer
Apr 24, 2012
1,301
16,912
153
Vukovar
Cyanogen is updating sources to lolipop right now and omni has semi working source so it will be easier to port 5.0 since we wont need to edit device tree that much
 

Restl3ss

Senior Member
Aug 3, 2013
633
1,075
0
Fort Mcmurray
Cyanogen is updating sources to lolipop right now and omni has semi working source so it will be easier to port 5.0 since we wont need to edit device tree that much
Yes but, they have a tentative deadline of dec. 1st to start pushing out the first nightlies. We likely won't be in the first wave either, since d2 is now 3 generations out of date.

I'd much rather just port aosp and have it in 2 weeks rather than wait 3 weeks to even begin work.

Side note. If/when I get this working I'm calling it PotatOS
 

Restl3ss

Senior Member
Aug 3, 2013
633
1,075
0
Fort Mcmurray
Managed to work past my problem with SElinux for now, the build has now moved on to... another set of errors!

Build currently hangs at this:
Code:
host C++: libutils_32 <= system/core/libutils/StopWatch.cpp
host C++: libutils_32 <= system/core/libutils/String8.cpp
host C++: libutils_32 <= system/core/libutils/String16.cpp
host C++: libutils_32 <= system/core/libutils/SystemClock.cpp
host C++: libutils_32 <= system/core/libutils/Threads.cpp
host C++: libutils_32 <= system/core/libutils/Timers.cpp
system/core/libutils/Timers.cpp: In function 'nsecs_t systemTime(int)':
system/core/libutils/Timers.cpp:43:13: error: 'CLOCK_BOOTTIME' was not declared in this scope
build/core/binary.mk:618: recipe for target 'out/host/linux-x86/obj32/STATIC_LIBRARIES/libutils_intermediates/Timers.o' failed
make: *** [out/host/linux-x86/obj32/STATIC_LIBRARIES/libutils_intermediates/Timers.o] Error 1

#### make failed to build some targets (01:19 (mm:ss)) ####
Going to bed, will get back at it in the morning. Source should be up on github by tomorrow night
 
  • Like
Reactions: whoot

polarEskimo

Senior Member
Jun 3, 2011
50
4
0
Rochester
Yes but, they have a tentative deadline of dec. 1st to start pushing out the first nightlies. We likely won't be in the first wave either, since d2 is now 3 generations out of date.

I'd much rather just port aosp and have it in 2 weeks rather than wait 3 weeks to even begin work.

Side note. If/when I get this working I'm calling it PotatOS
I'm with you on that, I'd rather have pure AOSP than buggy CM nightlies. Also interesting choice of ROM name lol. Thanks for your hard work and I'm looking forward to pulling down your repos so I can take a stab at these compile-time issues.
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone