[HOWTO] ✏ Compiling Fairphone Open OS / Rooting

I got one mce error with each temperature notice in dmesg, so I assume they they belong together. I installed mcelog to be able to maybe find out more about them. Indeed this doesn’t look normal, I’d say.

I’m sure that I used the correct chosecombo invocation, as I copy & pasted it from source.fairphone.com, but I’ll give it another try (and hope to catch more information about that mce’s in case they occur again.

Next failed compilation:

In file included from /home/simon/src/fairphone_os/external/stlport/stlport/stl/_pair.h:36:0,
                 from /home/simon/src/fairphone_os/external/stlport/stlport/stl/_algobase.h:50,
                 from /home/simon/src/fairphone_os/external/stlport/stlport/stl/_tree.h:54,
                 from /home/simon/src/fairphone_os/external/stlport/stlport/stl/_map.h:34,
                 from /home/simon/src/fairphone_os/external/stlport/stlport/map:36,
                 from external/chromium_org/third_party/webrtc/modules/video_coding/main/source/codec_database.h:14,
                 from external/chromium_org/third_party/webrtc/modules/video_coding/main/source/codec_database.cc:11:
/home/simon/src/fairphone_os/external/stlport/stlport/stl/type_traits.h:244:28: internal compiler error: Segmentation fault
    typedef __false_type    has_trivial_copy_constructor;
                            ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://source.android.com/source/report-bugs.html> for instructions.
build/core/binary.mk:619: recipe for target 'out/target/product/FP2/obj/STATIC_LIBRARIES/third_party_webrtc_modules_webrtc_video_coding_gyp_intermediates/third_party/webrtc/modules/video_coding/main/source/codec_database.o' failed
make: *** [out/target/product/FP2/obj/STATIC_LIBRARIES/third_party_webrtc_modules_webrtc_video_coding_gyp_intermediates/third_party/webrtc/modules/video_coding/main/source/codec_database.o] Error 1
make: *** Auf noch nicht beendete Prozesse wird gewartet …

#### make failed to build some targets (23:36 (mm:ss)) ####

dmesg:

[ 2643.249055] CPU0: Core temperature above threshold, cpu clock throttled (total events = 1)
[ 2643.249056] CPU1: Core temperature above threshold, cpu clock throttled (total events = 1)
[ 2643.249059] CPU3: Package temperature above threshold, cpu clock throttled (total events = 1)
[ 2643.249060] CPU2: Package temperature above threshold, cpu clock throttled (total events = 1)
[ 2643.249061] CPU1: Package temperature above threshold, cpu clock throttled (total events = 1)
[ 2643.249070] CPU0: Package temperature above threshold, cpu clock throttled (total events = 1)
[ 2643.253064] CPU1: Core temperature/speed normal
[ 2643.253065] CPU0: Core temperature/speed normal
[ 2643.253067] CPU2: Package temperature/speed normal
[ 2643.253068] CPU3: Package temperature/speed normal
[ 2643.253069] CPU0: Package temperature/speed normal
[ 2643.253076] CPU1: Package temperature/speed normal
[ 2702.560290] mce: [Hardware Error]: Machine check events logged

Edit: There is a file /var/log/mcelog:

mcelog: failed to prefill DIMM database from DMI data
mcelog: Family 6 Model 3d CPU: only decoding architectural errors
Hardware event. This is not a software error.
MCE 0
CPU 1 THERMAL EVENT TSC 548f30962de
TIME 1451671461 Fri Jan  1 19:04:21 2016
Processor 1 heated above trip temperature. Throttling enabled.
Please check your system cooling. Performance will be impacted
Running trigger `unknown-error-trigger'
STATUS 88030803 MCGSTATUS 0
MCGCAP 1000c07 APICID 1 SOCKETID 0
CPUID Vendor Intel Family 6 Model 61
mcelog: Family 6 Model 3d CPU: only decoding architectural errors
Hardware event. This is not a software error.
MCE 1
CPU 0 THERMAL EVENT TSC 548f309c4d6
TIME 1451671461 Fri Jan  1 19:04:21 2016
Processor 0 heated above trip temperature. Throttling enabled.
Please check your system cooling. Performance will be impacted
Running trigger `unknown-error-trigger'
STATUS 88030803 MCGSTATUS 0
MCGCAP 1000c07 APICID 0 SOCKETID 0
CPUID Vendor Intel Family 6 Model 61
mcelog: Family 6 Model 3d CPU: only decoding architectural errors
Hardware event. This is not a software error.
MCE 2
CPU 0 THERMAL EVENT TSC 548f38f81e3
TIME 1451671461 Fri Jan  1 19:04:21 2016
Processor 0 below trip temperature. Throttling disabled
Running trigger `unknown-error-trigger'
mcelog: Too many trigger children running already
STATUS 88040802 MCGSTATUS 0
MCGCAP 1000c07 APICID 0 SOCKETID 0
CPUID Vendor Intel Family 6 Model 61
mcelog: Family 6 Model 3d CPU: only decoding architectural errors
Hardware event. This is not a software error.
MCE 3
CPU 1 THERMAL EVENT TSC 548f38fcc84
TIME 1451671461 Fri Jan  1 19:04:21 2016
Processor 1 below trip temperature. Throttling disabled
Running trigger `unknown-error-trigger'
mcelog: Too many trigger children running already
STATUS 88040802 MCGSTATUS 0
MCGCAP 1000c07 APICID 1 SOCKETID 0
CPUID Vendor Intel Family 6 Model 61

But this seems just a notice about a “normal” behaviour (as the result of modern and bad design of laptops). The fans are not strong enough for the thermal design of the CPUs, so they have to throttle to provide less heat. No reason to fail any gcc process, just need to wait a little longer. Or am I wrong?

Well, I successfully compiled everything after repo sync

It is possible that the integrity of data in RAM or at the disk is at least endangered while CPU is already near or above trip temperature… Can you permanently throttle cpu speed, with cpupower or cpufreq, I don’t know which package is available on Ubuntu.

Can you permanently throttle cpu speed, with cpupower or cpufreq, I don’t know which package is available on Ubuntu.

In Windows you can undervolt the CPU. This leads to a lower core temperature and this postpones (or dismisses if you are lucky) the time when the CPU falls back t it’s initial speed. In Ubuntu you would need a special Kernel which would allow this. I have been looking for it but didn’t find any. On Windows however, I could undervold my i7 processor quite a bit, still running stable.

By the way: can you post an ls -la of the output folder? I would like to
check whether we have the same file sizes for the .img files.

You would imagine that in the year 2016 CPU/thermal management should work out of the box without disturbing any integrity… I mean, it’s not 1980 anymore… *shaking the head*

Anyway, cpufreq is available on Ubuntu and I’ve set my i5 it to 900Mhz:

simon@laptop:~$ sudo cpufreq-set -r -u 1GHz
simon@laptop:~$ sudo cpufreq-set -r -d 1GHz
simon@laptop:~$ cpufreq-info | grep "momentane Taktfre"
  momentane Taktfrequenz ist 900 MHz.
  momentane Taktfrequenz ist 900 MHz.
  momentane Taktfrequenz ist 900 MHz.
  momentane Taktfrequenz ist 900 MHz.
simon@laptop:~$ 

(sorry for the German)
@USB-2: It seems you don’t need any special kernel or such. And probably better use sha instead of the file size to compare files.

I’ve started another round of compilation but at 900MHz it probably will take a little longer…

Good idea!

Using

sha256sum *.img

I get:

ee8ed45166346c3ad4629a2e492a29ee63ba282ab3e3eedeefc2de99405de571  boot.img
0f1efa291c13b35e5b1fe2d95196bb45fa781213c76bc95a0fce739b4c50f5bc  cache.img
34e5437a02bb2113437dbee43f94f79f263bd90e17c82e6b14b5ae466eadb964  dt.img
0ab0d3ab8ead3400212917bc9ef892af26f0e219af98c9efff0df10c07436c1c  persist.img
ff4f1e248890b9cefbf89599e0a735f4b909921c5d763ea7f1d0571a7f930f09  ramdisk.img
35bd604e4da39bca71a2d47151bc61eb2bde441836bb972bce9822e1338bf5d8  ramdisk-recovery.img
04c4b9fd753acac36efcf68d1c8149da3b64a7523367a0b2a5fcaa1537f9a9e9  recovery.img
f677a06184aa290296c67f0766d6b19b5df66ab71fffd31e7b7ab261ec915ff9  splash.img
f8d171ba327c18191cf71e5b7ae3b939c7bf228cd0579e3412ae207911c1e8bc  system.img
71eaa073ff83a6985189fd124ae595cac2a6895b35577ae50d8eaa6763e8c1d8  userdata.img

Anyone “better” results? :wink:

This is my output dir:

[QUOTE]klaus@klaus-virtual-machine:~/fairphone_os/out/target/product/FP2$ ls -la
total 668308
drwxrwxr-x 12 klaus klaus 4096 Jan 1 21:01 .
drwxrwxr-x 4 klaus klaus 4096 Dez 31 16:53 …
-rw-rw-r-- 1 klaus klaus 10 Dez 31 16:16 android-info.txt
-rw-rw-r-- 1 klaus klaus 15257600 Jan 1 17:09 boot.img
-rw-rw-r-- 1 klaus klaus 15255552 Jan 1 17:08 boot.img.nonsecure
drwxrwxr-x 2 klaus klaus 4096 Dez 31 21:43 cache
-rw-r–r-- 1 klaus klaus 12820796 Dez 31 21:43 cache.img
-rw-rw-r-- 1 klaus klaus 61394 Jan 1 20:59 clean_steps.mk
drwxrwxr-x 5 klaus klaus 4096 Jan 1 02:25 data
-rw-r–r-- 1 klaus klaus 5828608 Jan 1 17:08 dt.img
-rw-rw-r-- 1 klaus klaus 549928 Jan 1 17:06 emmc_appsboot.mbn
-rwxrwxr-x 1 klaus klaus 549888 Jan 1 17:06 emmc_appsboot.raw
-rw-rw-r-- 1 klaus klaus 549928 Jan 1 17:06 EMMCBOOT.MBN
drwxrwxr-x 2 klaus klaus 4096 Dez 31 18:58 fake_packages
drwxrwxr-x 5 klaus klaus 4096 Dez 31 20:31 gen
-rw-rw-r-- 1 klaus klaus 111514 Jan 1 17:08 installed-files.txt
-rwxrwxr-x 1 klaus klaus 6601296 Jan 1 17:08 kernel
drwxrwxr-x 21 klaus klaus 4096 Jan 1 03:18 obj
drwx------ 4 klaus klaus 4096 Dez 31 16:18 persist
-rw-r–r-- 1 klaus klaus 5088376 Dez 31 20:11 persist.img
-rw-rw-r-- 1 klaus klaus 328 Jan 1 20:59 previous_build_config.mk
-rw-rw-r-- 1 klaus klaus 2821353 Jan 1 13:19 ramdisk.img
-rw-rw-r-- 1 klaus klaus 1408248 Jan 1 17:08 ramdisk-recovery.img
drwxrwxr-x 3 klaus klaus 4096 Jan 1 17:08 recovery
-rw-rw-r-- 1 klaus klaus 13844480 Jan 1 17:09 recovery.img
-rw-rw-r-- 1 klaus klaus 13842432 Jan 1 17:08 recovery.img.nonsecure
drwxrwxr-x 9 klaus klaus 4096 Jan 1 13:16 root
-rw-rw-r-- 1 klaus klaus 6221312 Dez 31 16:18 splash.img
drwxrwxr-x 5 klaus klaus 4096 Dez 31 21:45 symbols
drwxrwxr-x 14 klaus klaus 4096 Dez 31 19:58 system
-rw-r–r-- 1 klaus klaus 440528764 Jan 1 17:09 system.img
-rw-r–r-- 1 klaus klaus 142911480 Jan 1 17:09 userdata.img
klaus@klaus-virtual-machine:~/fairphone_os/out/target/product/FP2$
[/QUOTE]
But I get this while booting:

[QUOTE]
D/AndroidRuntime( 1166): >>>>>> START com.android.internal.os.ZygoteInit uid 0 <<<<<<
E/JniInvocation( 1166): Failed to dlopen libart.so: dlopen failed: library “libart.so” not found
D/AndroidRuntime( 1166): CheckJNI is OFF
F/libc ( 1166): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 1166 (zygote)
I/mediaserver( 1165): ServiceManager: 0xb58700c0
I/AudioFlinger( 1165): Using default 3000 mSec as standby time.
I/ServiceManager( 1165): Waiting for service batterystats…
I/DEBUG ( 261): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 261): Build fingerprint: 'Fairphone/FP2/FP2:5.1/FP2/klaus12311418:userdebug/test-keys’
I/DEBUG ( 261): Revision: '0’
I/DEBUG ( 261): ABI: 'arm’
I/DEBUG ( 261): pid: 1166, tid: 1166, name: zygote >>> zygote <<<
I/DEBUG ( 261): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
I/DEBUG ( 261): r0 b6f9c4c8 r1 be8c674c r2 be8c5758 r3 00000000
I/DEBUG ( 261): r4 00000023 r5 00010004 r6 be8c5758 r7 00000000
I/DEBUG ( 261): r8 be8c6694 r9 be8c57c4 sl be8c57d8 fp b6f74101
I/DEBUG ( 261): ip b676cf88 sp be8c5740 lr b6f1e4a3 pc 00000000 cpsr a0000010
I/DEBUG ( 261):
I/DEBUG ( 261): backtrace:
I/DEBUG ( 261): #00 pc 00000000
I/DEBUG ( 261): #01 pc 0005c49f /system/lib/libandroid_runtime.so (android::AndroidRuntime::startVm(_JavaVM**, _JNIEnv**)+2286)
I/DEBUG ( 261): #02 pc 0005cae7 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vectorandroid::String8 const&)+258)
I/DEBUG ( 261): #03 pc 00001675 /system/bin/app_process32
I/DEBUG ( 261): #04 pc 0000fec9 /system/lib/libc.so (__libc_init+44)
I/DEBUG ( 261): #05 pc 000017b0 /system/bin/app_process32
I/DEBUG ( 261):
I/DEBUG ( 261): Tombstone written to: /data/tombstones/tombstone_08
[/QUOTE]
and of course no successful boot…#

Hmm,

I have different file sizes. :flushed:

I have compiled it as described here:

`> https://forum.fairphone.com/t/create-a-pre-rooted-system/

I didn’t have 8GB of free memory at the first run, so I started another one which needed only like 10 minutes to complete. Maybe this interruption caused another file size. Only Deus Ex Machina knows…

still compiling over here… :confused:

*ouch* did you try it on the phone or in an emulator? Can you still reset it to factory defaults or does the original OS get overwritten by flashing it?
Maybe it’s better to wait until the Fairphone Dev’s provide an “official” build, which is guaranteed to run – once the holidays are over… :slight_smile:

I can only recommend to everybody: don’t flash anything before you made a Nandroid Backup. I don’t know if this is possible with the Fairphone’s original recvovery as I don’t have my phone yet…

No, no way to factory reset or anything.

Going to reset everything up again and do a fresh build.

Pressing my thumbs for you. Otherwise hope that Fairphone soon releases some working builds. :slight_smile:

1 Like

Hi,
I can’t contribute to the programming/compiling issues but I already have the phone so I can at least say that there isn’t any option to do a backup in the original recovery.

The menu shows:

-reboot system now
-apply update from ADB
-wipe data/ factory reset
-wipe cache partition
-reboot to bootloader
-power down
-view recovery logs
-apply update from sdcard

I also tried the reboot-to-bootloader-option but the screen freezed and after 2mins I manually rebooted the phone. Repeated two times trying to enter bootloader with same results.

Finally I want to say that I’m quite excited and thankful that there already are people trying to provide a GMS-free ROM. Keep on!
Happy new year

1 Like

if you reboot to bootloader, it’s waiting for external commands. You can check with fastboot devices. You can flash images here with fastboot.

There should be a way to do a full backup via ADB?! First search result: http://www.howtogeek.com/125375/how-to-create-a-full-android-phone-or-tablet-backup-without-rooting-or-unlocking-your-device/

However, I’d still rather use TWRP recovery… :wink:

adb backups are only apps and data. TWRP would be the way to go, yes…

1 Like

As I’m an Android noob my idea might be rubbish, but maybe with adb a backup could have been taken with dd? anyway, if it is bricked already, it’s too late now anyway…

edit: obviously one of us could factory reset and then create a backup for you to restore (if there is no problem with serial numbers or such).

Ok, must admit that I’m not into ADB-stuff at all.

You could take a disk image with dd, yes. But right now I fail to see how to restore this image. Might be flashable, but I’m not sure. With TWRP this would be easier, but the fairphone recovery is quite simplistic.Will try a fresh build (which takes some time). So, as long as my device is bricked, I might as well test your builds :wink:

edit: or better, not the device is bricked, only system

I have that (compiled it yesterday under Ubuntu 14.04) :

$ sha256sum ./*.img 78bb1505401ee291f398306922e998a79098738b2c95610a37ba2e373df1facb ./boot.img 0f1efa291c13b35e5b1fe2d95196bb45fa781213c76bc95a0fce739b4c50f5bc ./cache.img 34e5437a02bb2113437dbee43f94f79f263bd90e17c82e6b14b5ae466eadb964 ./dt.img 78e04cad74b1dec7f7615670c6c01571af4c53996ef488648b8bdd05dc5250ce ./persist.img 12e958bade419ada49caad01824d7502fdf1815c8740789849f1b142bd22492f ./ramdisk.img 44e27feebced9583ba0bcb8e2f2e5f00f2f953d4fbe7b90c49c7c9872979e24c ./ramdisk-recovery.img 3d3644625694670857de24b21cbbc223d07b9e14c6e2f2fd7a0fed66b6452109 ./recovery.img f677a06184aa290296c67f0766d6b19b5df66ab71fffd31e7b7ab261ec915ff9 ./splash.img b8932935a1c7404342cd935aee50cab292f69f0c6553c68773771977cf4ad314 ./system.img bd25a51652c38f192bdb658029fbc0ccba674492c728a759af6fa2ec1564625c ./userdata.img

Looks like we can’t expect them to be equal after all :smile: