Building the kernel
-
Can anyone give me / point me towards any instructions on how to build the kernel for a given channel?
Also is it possible to build and flash just the kernel or would it be easier to build everything?I'm on bacon, 15.04 rc at the moment and there are a couple of config options I think should be changed, although I would like to test them first for myself:
The max cpu frequency is currently limited to 1958400 (normal max frequency is 2457600) -- the original commit for this says it was to reduce UI stuttering due to thermal throttling, but it was later removed (at least in LineageOS, not sure about other repos) and I never experienced any thermal throttling on Android. In fact I found the higher max cpu frequency also used less battery, presumably due to fewer cores being hotplugged or not being online for as long.
Ondemand governer is not built into the kernel at the moment, and (for the kinds of things I used my phone for in Android) I always found ondemand more responsive and more battery friendly than interactive.
-
@rulionlisk hi, see https://forums.ubports.com/topic/349/how-to-compile-only-a-kernel
-
Thanks @advocatux, that got me started. I haven't got much further though.
Anyone know why I might be getting these errors? Haven't found anything that seems relevant on google yet.arch/arm/crypto/aesbs-core.S: Assembler messages: arch/arm/crypto/aesbs-core.S:451: Error: thumb conditional instruction should be in IT block -- `addeq r6,r6,#0x10' arch/arm/crypto/aesbs-core.S:906: Error: thumb conditional instruction should be in IT block -- `addeq r6,r6,#0x10' make[1]: *** [arch/arm/crypto/aesbs-core.o] Error 1
but it looks to me (after some searching and with only a very basic understanding of assembly) that they are in IT blocks:
$ grep -C 2 -n addeq arch/arm/crypto/aesbs-core.S 449- vldmia r6, {q12} @ .LISR 450- ite eq @ Thumb2 thing, sanity check in ARM 451: addeq r6,r6,#0x10 452- bne .Ldec_loop 453- vldmia r6, {q12} @ .LISRM0 -- 904- vldmia r6, {q12} @ .LSR 905- ite eq @ Thumb2 thing, samity check in ARM 906: addeq r6,r6,#0x10 907- bne .Lenc_loop 908- vldmia r6, {q12} @ .LSRM0
Are there any other guides I should look at? I'm sure I saw some on the old wiki, but I can't find them now.
EDIT(2018-05-01):
@doniks said in Atom Build Clickable (March 18):
Maybe you're still not using the right compiler. Please give more context. Post all the commands you ran to get there.
@rulionlisk said in Building the kernel:
Are there any other guides I should look at? I'm sure I saw some on the old wiki, but I can't find them now.
Thanks @doniks, I'll have a read through that and try again
As to context for the above errors, it was run on an ubuntu 14.04.5 LTS image on AWS (because I believe kernels older than 3.18 require gcc 4.8)
git clone -b ubp-5.1-caf https://github.com/ubports/android_kernel_oneplus_msm8974.git cd android_kernel_oneplus_msm8974 make ARCH=arm bacon_defconfig make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf-
I then tried to setup the android build environment manually following google AOSP instructions and using ubports/android manifest but didn't get very far with that...
I'm going to try and set up the build environment again with those wiki instructions using the phablet team ppa and hopefully I'll get a bit further. -
@rulionlisk maybe consider that hack with the bin-gcc-4.8 folder at the start of your PATH to make sure it picks the right compiler
-
Finally got everything working.
Notes here in case anyone else is interested, or I forget what I did later.
Building the kernel and android system using phablet-tools is much easier and actually takes up less space than manually doing a repo sync for just the kernel! (Fits comfortably in a 30GB vm).
On an ubuntu 16.04 vm:
sudo add-apt-repository ppa:phablet-team/tools sudo apt-get update sudo apt-get install phablet-tools
Install build requirements:
sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install git gnupg flex bison gperf build-essential \ zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \ g++-4.8-multilib
Ignore section about installing repo, there is already a package for it which is a dependency of phablet-tools
mkdir ~/phablet cd ~/phablet repo init -u https://github.com/ubports/android -b ubp-5.1
local manifest (for oneplus one):
touch .repo/local_manifests/oneplus_bacon.xml
I used this for oneplus_bacon.xml:
<?xml version="1.0" encoding="UTF-8"?> <manifest> <project path="device/oneplus/bacon" name="ubports/android_device_oneplus_bacon-1" remote="ubp" /> <project path="device/oppo/common" name="ubports/android_device_oppo_common" remote="ubp" /> <project path="device/qcom/common" name="android_device_qcom_common" remote="cm" /> <project path="kernel/oneplus/msm8974" name="ubports/android_kernel_oneplus_msm8974" remote="ubp" revision="refs/heads/ubp-5.1-caf" /> <project path="vendor/oppo" name="proprietary_vendor_oppo" remote="them" /> <project path="vendor/oneplus" name="proprietary_vendor_oneplus" remote="them" /> </manifest>
Then:
repo sync
...and wait for a long time...
change whatever you want, then:
. build/envsetup.sh lunch
and select 9 (cm_bacon-userdebug)
make
My experiments were not very successful - I thought that some of the high battery usage might be partially due to the kernel not being properly tuned for the way the phone operates and wakes on ubuntu-touch.
Unfortunately, nothing I tried made much difference really - the phone is simply waking a lot and doing a lot in the background and no kernel tuning is going to make a big difference to the amount of power that uses.
RC OTA-4 (16.04) has just been released though, so I'll have a play with that and have another look at the kernel later. -
@rulionlisk nice! Does that result in a boot.img then? Also system.img? Which rootfs do you use? How do you install to device?
-
@doniks yes that creates the boot.img and system.img (and a recovery.img as well)
flashing the kernel is easy:
fastboot flash boot boot.img
If there are changes made to system.img the easiest way I have found to flash is to
adb push system.img system.img adb reboot recovery
and in recovery there is an option (can't remember exact names) under ubuntu options to flash system - make sure you navigate to user_data (or wherever you pushed it to if different) - the first system.img option that I saw (and pressed) stopped my phone from booting...
Not sure what you mean by which rootfs, I just used what was pulled in and only tried changing a few kernel config options and modules
-
modules:composer.user_said_in, @rulionlisk, Building the kernel
@doniks yes that creates the boot.img and system.img (and a recovery.img as well)
flashing the kernel is easy:
fasboot flash boot boot.img
If there are changes made to system.img the easiest way I have found to flash is to
adb push system.img system.img adb reboot recovery
and in recovery there is an option (can't remember exact names) under ubuntu options to flash system - make sure you navigate to user_data (or wherever you pushed it to if different) - the first system.img option that I saw (and pressed) stopped my phone from booting...
ok, clear. thanks!
Not sure what you mean by which rootfs, I just used what was pulled in and only tried changing a few kernel config options and modules
what I meant is how did you get the operating system installed. so far we're only talking kernel and android container: "system.img"
... ah, I guess I get it: Your device is supported by ubports installer, you just install as usual and AFTERWARDS starts all the fun described here?!
-
@doniks yes, I'm just using the ubports installer, then after, flashing changes to boot.img and system.img to an already working ubuntu-touch phone (bacon)