Skip to main content

Building Android Cross Compiler with Crosstool-ng

In order for you to rebuilt a kernel (or even a ROM) for Android from your laptop, you need a cross compiler to do that.

For Android ecosystem there are several popular cross compilers that being used:


  1. Android NDK
  2. Android Toolchain (which I believe a subset of the NDK)
  3. Linaro customized cross compiler 
  4. Self-made cross compiled built by using crosstool-ng
  5. You do it yourself (but I never succeed this one)
I currently use crosstool-ng cross compiler "cooking tool" as it has several features;

You can save a stage for the built process. For example, I just got my laptop shutdown automatically (perhaps due to CPU overheating.. never shut it down for approx due days).. and since I chose the option for saving the compile state, the process just can be restarted at the previous stage:

Just use the build.log and parse the related info


najmi@vostro:~/toolchain/build-cng$ cat build.log |grep "Saving state"
[EXTRA]  Saving state to restart at step 'libc_check_config'...
[EXTRA]  Saving state to restart at step 'companion_libs_for_build'...
[EXTRA]  Saving state to restart at step 'binutils_for_build'...
[EXTRA]  Saving state to restart at step 'companion_libs_for_host'...
[EXTRA]  Saving state to restart at step 'binutils_for_host'...
[EXTRA]  Saving state to restart at step 'cc_core_pass_1'...
[EXTRA]  Saving state to restart at step 'kernel_headers'...
[EXTRA]  Saving state to restart at step 'libc_start_files'...
[EXTRA]  Saving state to restart at step 'cc_core_pass_2'...
[EXTRA]  Saving state to restart at step 'libc'...
[EXTRA]  Saving state to restart at step 'cc_for_build'...
[EXTRA]  Saving state to restart at step 'cc_for_host'...
najmi@vostro:~/toolchain/build-cng$ ct-ng cc_for_host+

 
The problem with abruptly terminated compilation process could also due to error in the compilation process. That way you just have to start where you suspect the compilation error occurs;

Simply with you can continue from the last saved state onwards;


najmi@vostro:~/toolchain/build-cng$ unset LD_LIBRARY_PATH
najmi@vostro:~/toolchain/build-cng$ ct-ng cc_for_host+
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20131130.102737
[INFO ]  Building environment variables
[EXTRA]  Preparing working directories
[EXTRA]  Restoring state at step 'cc_for_host', as requested.
[INFO ]  =================================================================
[INFO ]  Installing final compiler
[EXTRA]    Configuring gcc
[EXTRA]    Building gcc
[07:57] / 



Comments

Popular posts from this blog

Gue dengan S2 gue. Sronok banget!
Sed (streaming editor) big time mnajem @zalzalah ~ $ cat ustazasri.txt >Kuliah Dr. Mohd. Asri Zainul Abidin (Julai 2005) >>Tarikh >>Tempat >>Waktu >>Tajuk >>15 Julai 2005 JUMAAT >>Surau al-Muhajirun, Taman Sri Ukay, Ampang >>Selepas Maghrib >>Riyadh al-Salihin (Kitab Perkara yang Ditegah) >>16 Julai 2005 SABTU >>Balai Budaya Tun Syed Nasir, DBP Kuala Lumpur >>8.30 pagi ¿ 1.00 tgh >>DEBAT Astora Jabat vs Dr. Mohd. Asri ¿ Gerakan Tajdid: Satu Perbincangan >>17 Julai 2005 AHAD >>Dewan Kuliah, Balai Islam Masjid al-Ghufran, Pinggiran Taman Tun Dr. Ismail >>10.00 pagi >>Riyadh al-Salihin (Kitab Perkara yang Disuruh, Bab al-Taqwa, Bab ke-6) >>17 Julai 2005 AHAD >>Masjid Jamek Abdul Aziz, Jalan Templer, Petaling Jaya >>Selepas Maghrib >>Sahih al-Bukhariy (Kitab al-Iman) >>*Kuliah Maghrib di Masjid Al-Syakirin, Bandar Utama dibatalkan.> mnajem@zalzalah ~ $ sed -i...
........speechless Salam, Aku lately mengalami masalah kesempitan wang yang serius disebabkan kereta satria aku yang berusia 10 tahun ada major repair.. dalam bulan ni je untuk kereta aku abis RM600 untuk maintenance. Ganti spectacle lagi. Accumulated maintaince expense untuk keta yang aku beli sejak Disember 2005 ni dekat RM3000 jugak. Ganti absorber,ganti tayar (haritu kan pancit-tayar last yang aku tak penah ganti pancit balik dari Kangar. Tayar tu tahun 2001. Owner lama tak tukar. Nasib la). Gaji macam aku ni dok seorang pun dah boleh jadi defisit, nak bayar PTPTN(auto deduct), loan laptop aku 2 tahun, then medical card(aku memikirkan sebab arwah abang aku dulu pernah kena kanser umur 29 tahun.. dan kebetulan dia ambik insurans tu tak jauh tarikh dari dia kena sakit tu, kampeni insurans tak nak bayar sebab assume dia dah tau sakit baru ambik polisi. Nak buat macam mana. So sewaktu sihat la fikir nak ambil polisi gini). Memang ada medical benefit, tapi kita tak tau future jadi apa, ...