Help with compiling / porting MultiRom / TWRP for Aquaris E5? - Android Q&A, Help & Troubleshooting
I would like to have a dual boot (Android / Ubuntu Touch) on an Aquaris E5 HD phone ( the Ubuntu Touch variant can be flashed with stock Android and vice versa, see mibqyyo.com/en-articles/2015/09/16/ubuntu-android-installation-process-for-bq-aquaris-e4-5-and-e5 ). ((sorry for the links, new user))
Unfortunately, the instructions from wiki.ubuntu.com/Touch/DualBootInstallation do not work with this phone anymore: it seems that the software in those instructions relies on the device having custom ClockworkMod (CWM) recovery -- and, it seems ClockworkMod does not support this device anymore, if it ever did ( see askubuntu.com/questions/666070/cant-install-ubuntu-touch-dual-boot-on-mobile-stuck-in-waiting-for-device/776357 ).
The only other option I could see for dual boot is MultiROM Manager, unfortunately it fails with "This is unsupported device (Aquaris_E5_HD)!"
However, it is possible to root this phone using a TeamWin Recovery Project (TWRP) custom recovery image ( v3.0.2-0, see mibqyyo.com/comunidad/discussion/77467/how-to-root-a-bq-aquaris-e5-hd-phone ), which seemingly does support this phone. Furthermore, from twrp.me/devices/bqaquarise5hd.html there is a reference to:
Device Tree / files: github.com/TeamWin/android_device_bq_vegetahd - and from there:
Kernel source available on: github.com/bq/aquaris-E5
So, I thought - maybe it would be possible to port / build MultiROM from source, with support for this device? I tried something, and maybe I even got part of the way - unfortunately I cannot get the build to complete, so I hope I can get some assistance here. I will outline the steps I did below. First of all, I use this as my PC:
Code:
$ uname -a
Linux MYPC 4.2.0-38-generic #45~14.04.1-Ubuntu SMP Thu Jun 9 09:27:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 14.04.4 LTS \n \l
Then I looked at github.com/Tasssadar/multirom/wiki/Porting-MultiROM:
Prerequisites
* Android 4.1+ tree
* TWRP ported to your device. There are guides on the internet on how to do that.
* Kernel sources
Downloading sources
Just clone TWRP, MultiROM and libbootimg repos into your Android Tree, the commands would look something like this: [...]
Click to expand...
Click to collapse
I was somewhat puzzled about what this "Android Tree" is, but eventually I guessed it is the Android Open Source Project (AOSP) source code. So, I looked and did this:
source.android.com/source/initializing.html
(Note: http removed from links in code below, because I'm a new user and cannot post links):
Code:
cd /tmp
wget archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre-headless_8u45-b14-1_amd64.deb
wget archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jre_8u45-b14-1_amd64.deb
wget archive.ubuntu.com/ubuntu/pool/universe/o/openjdk-8/openjdk-8-jdk_8u45-b14-1_amd64.deb
sudo dpkg -i openjdk-8-jre-headless_8u45-b14-1_amd64.deb
sudo dpkg -i openjdk-8-jre_8u45-b14-1_amd64.deb
sudo dpkg -i openjdk-8-jdk_8u45-b14-1_amd64.deb
sudo apt-get -f install
# already have libgl1-mesa-dev-lts-wily mesa-common-dev-lts-wily
# so removed libgl1-mesa-dev from list below:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libxml2-utils xsltproc unzip
sudo apt-get autoremove --purge
wget -S -O - source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules
# for the aquaris:
echo "SUBSYSTEM==\"usb\", ATTRidVendor==\"2a47\", ATTRidProduct==\"201d\", MODE=\"0600\", OWNER=\"$USER\"" \
| sudo tee -a /etc/udev/rules.d/51-android.rules
sudo udevadm control --reload-rules
then
source.android.com/source/downloading.html
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
cd /path/to/src
mkdir AOSP
cd AOSP
repo init -u android.googlesource.com/platform/manifest -b android-4.1.2_r2.1 2>&1 | tee repo.log
repo sync
Note that here, I took the `4.1+` requirement quite literally, so just chose to checkout the last 4.1 branch, `4.1.2_r2.1`.
Also, repo sync took 14+ hours to complete, for my PC+Internet connection combo (!)
With that done, I have this in the directory:
Code:
AOSP$ ls
abi cts docs hardware ndk prebuilts
bionic dalvik external libcore packages repo.log
bootable development frameworks libnativehelper pdk sdk
build device gdk Makefile prebuilt system
Now, at this point, we should be running build/envsetup.sh and lunch; however, that will cause only the default Google devices (Nexus etc) to be recognized. So, here I did cloned the "device tree" (I guess) into the "Android tree":
Code:
AOSP$ mkdir device/bq
AOSP$ git clone github.com/TeamWin/android_device_bq_vegetahd device/bq/vegetahd
AOSP$ chmod +x device/bq/vegetahd/vendorsetup.sh
AOSP$ ls device/bq/vegetahd/
AndroidBoard.mk BoardConfig.mk kernel omni_vegetahd.mk recovery
AndroidProducts.mk device.mk mkbootimg.mk README.md vendorsetup.sh
AOSP$ ls device/samsung/crespo # for comparison
Android.mk full_crespo.mk libsensors recovery
AndroidProducts.mk gps.conf libstagefrighthw recovery.fstab [...]
vendorsetup.sh
and also cloned the Omnirom TWRP recovery sources (note that if you just mv bootable/recovery bootable/old.recovery, then the builds process may also pick some of those files up, so that directory should be deleted, as guides elsewhere recommend):
Code:
AOSP$ rm -rf bootable/recovery
cd bootable
git clone https://github.com/omnirom/android_bootable_recovery.git recovery-twrp
cd ..
Since build/envsetup.sh should be running the vendorsetup.sh when it finds them, after running it, the Aquaris device should be visible:
Code:
AOSP$ source build/envsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/bq/vegetahd/vendorsetup.sh # ***
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/armv7-a/vendorsetup.sh
including device/moto/wingray/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash
AOSP$ lunch
You're building on Linux
Lunch menu... pick a combo:
1. full-eng
2. full_x86-eng
3. vbox_x86-eng
4. full_grouper-userdebug
5. omni_vegetahd-eng # ***
6. mini_armv7a_neon-userdebug
7. mini_armv7a-userdebug
8. full_wingray-userdebug
9. full_crespo-userdebug
10. full_maguro-userdebug
11. full_panda-userdebug
Which would you like? [full-eng] 5
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.1.2
TARGET_PRODUCT=omni_vegetahd
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.2.0-38-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=JZO54M
OUT_DIR=out
============================================
Now, it seems that for such an old version like 4.1.2_r2.1, there is no mka command (not found), which should otherwise be ran at this point - however, I can run make instead of it.
Also because it's so old, I get "You are attempting to build with the incorrect version of java. Your version is: openjdk version "1.8.0_45-internal". The correct version is: Java SE 1.6.", which it so happens, I have - but I have to set environment variables. So here I run:
Code:
AOSP$ export RECOVERY_VARIANT=twrp
AOSP$ ANDROID_PRE_BUILD_PATHS=/path/to/jdk1.6.0_45/bin \
ANDROID_JAVA_TOOLCHAIN=/path/to/jdk1.6.0_45/bin \
JAVA_HOME=/path/to/jdk1.6.0_45 \
PATH=/path/to/jdk1.6.0_45/bin:$PATH \
make -j3 recoveryimage
...
target thumb C: adbd <= system/core/adb/log_service.c
make: *** No rule to make target `out/target/product/vegetahd/obj/EXECUTABLES/recovery_intermediates/recovery', needed by `out/target/product/vegetahd/recovery.img'. Stop.
make: *** Waiting for unfinished jobs....
target thumb C: adbd <= system/core/adb/utils.c
... but as you can see, it fails. This was for the Omnirom sources of TWRP recovery.
Then I thought of going back to the Multirom porting, and so did this:
Code:
AOSP$ rm -r bootable/recovery-twrp
git clone github.com/Tasssadar/Team-Win-Recovery-Project.git bootable/recovery
git clone github.com/Tasssadar/multirom.git system/extras/multirom
git clone github.com/Tasssadar/libbootimg.git system/extras/libbootimg
cd system/extras/multirom
git submodule update --init
cd ../../..
Then I checked the touchpad from adb shell as root:
Code:
cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="mtk-tpd"
P: Phys=
S: Sysfs=/devices/virtual/input/input3
U: Uniq=
H: Handlers=mouse0 event3 cpufreq
B: PROP=2
B: EV=b
B: KEY=10 0 0 0 0 0 0 0 400 0 0 0 0 1000 40000000 100000 0 0 0
B: ABS=6630000 1000003
... so definitely "type b"; then by doing `find /sys | grep uevent` and comparing as in the porting guide, I put together this file as device/bq/vegetahd/mr_init_devices.c:
Code:
#include <stdlib.h>
// These are paths to folders in /sys which contain "uevent" file
// need to init this device.
// MultiROM needs to init framebuffer, mmc blocks, input devices,
// some ADB-related stuff and USB drives, if OTG is supported
// You can use * at the end to init this folder and all its subfolders
const char *mr_init_devices[] =
{
"/sys/devices/platform/mtkfb.0/graphics/fb0",
"/sys/devices/platform/mtkfb.0",
"/sys/devices/platform/mtk-msdc.0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot0",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0boot1",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0rpmb",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p1",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p2",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p3",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p4",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p5",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p6",
"/sys/devices/platform/mtk-msdc.0/mmc_host/mmc0/mmc0:0001/block/mmcblk0/mmcblk0p7",
"/sys/devices/platform/mtk-msdc.1",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1/mmc1:0007",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1/mmc1:0007/block/mmcblk1/mmcblk1p1",
"/sys/devices/platform/mtk-msdc.1/mmc_host/mmc1/mmc1:0007/block/mmcblk1",
"/sys/bus/mmc/uevent",
"/sys/bus/mmc/drivers/mmcblk/uevent",
"/sys/bus/sdio/uevent",
"/sys/devices/virtual/input/*",
"/sys/devices/virtual/misc/uinput",
"/sys/devices/platform/mtk-tpd",
"/sys/devices/platform/mtk-kpd",
"/sys/devices/platform/mtk-kpd/input/input0",
"/sys/devices/platform/mtk-kpd/input/input0/event0",
"/sys/devices/platform/mtk-kpd/misc/mtk-kpd",
// for adb
"/sys/devices/virtual/tty/ptmx",
"/sys/devices/virtual/misc/android_adb",
"/sys/devices/virtual/android_usb/android0/f_adb",
"/sys/bus/usb",
NULL // must be NULL-terminated
}
Then I inspected boot.img of the stock Android firmware:
Code:
$ /path/to/bootimg_tools/boot_info /path/to/bq/2.1.0_20151104-0859_E5HD_bq-FW/boot.img
Page size: 2048 (0x00000800)
Kernel size: 3747904 (0x00393040)
Ramdisk size: 615529 (0x00096469)
Second size: 0 (0x00000000)
Board name: fbcdadc
Command line: ''
Base address: 2147483648 (0x80000000)
... and also did:
Code:
mkdir device/bq/vegetahd/mrom-infos/
wget raw.githubusercontent.com/Tasssadar/device_asus_grouper/cm-10.2-mrom/mrom_infos/ubuntu_touch.txt -O device/bq/vegetahd/mrom-infos/ubuntu_touch.txt
... and confirmed paths, and could finally add this to device/bq/vegetahd/BoardConfig.mk :
Code:
#MultiROM config. MultiROM also uses parts of TWRP config
MR_INPUT_TYPE := type_b
MR_INIT_DEVICES := device/bq/vegetahd/mr_init_devices.c
MR_RD_ADDR := 0x82500000
MR_DPI := hdpi
MR_DPI_FONT := 216
MR_FSTAB := device/bq/vegetahd/recovery/etc/twrp.fstab
MR_KEXEC_MEM_MIN := 0x85000000
MR_INFOS := device/bq/vegetahd/mrom_infos
Here, if I run ... make ... (after first exiting the old terminal shell, and repeating envsetup.sh / lunch in a new one), I get "build/core/base_rules.mk:103: *** user tag detected on new module - user tags are only supported on legacy modules. Stop." So, I did these changes:
Code:
# bootable/recovery/Android.mk:
LOCAL_MODULE := recovery
LOCAL_MODULE_TAGS := optional # add
# bootable/recovery/tests/Android.mk:
LOCAL_MODULE := asn1_decoder_test
LOCAL_MODULE_TAGS := optional # add
Then, a ... make ... at this point fails with: "make: *** No rule to make target `out/target/product/vegetahd/system/xbin/busybox', needed by `out/target/product/vegetahd/obj/SHARED_LIBRARIES/libbmlutils_intermediates/teamwin'. Stop.".
Here I found "[DEV]How to compile TWRP touch recovery - Pg. 150 | Android Development and Hacking" ( forum.xda-developers.com/showthread.php?p=65556586 ), and I downloaded busybox.zip from that page - and did:
Code:
AOSP$ unzip busybox.zip
AOSP$ mv busybox external/
Now, the ... make ... at this point is a bit funny, because it will exit not reporting an error, as if it finished:
Code:
AOSP$ ANDROID_PRE_BUILD_PATHS=/path/to/jdk1.6.0_45/bin \
ANDROID_JAVA_TOOLCHAIN=/path/to/jdk1.6.0_45/bin \
JAVA_HOME=/path/to/jdk1.6.0_45 \
PATH=/path/to/jdk1.6.0_45/bin:$PATH \
make -j3 recoveryimage
...
GEN include/usage_compressed.h
GEN include/applet_tables.h
HOSTCC applets/usage_pod
GEN include/bbconfigopts.h
CC applets/applets.o
LD applets/built-in.o
make[1]: Leaving directory `/media/Data1/src/AOSP/external/busybox'
AOSP$
But here it is apparently just done with applets in busybox! So, I try running ... make ... again, and get:
Code:
external/busybox/android/librpc/bindresvport.c:41:13: error: conflicting types for '__set_errno'
bionic/libc/include/errno.h:45:15: note: previous declaration of '__set_errno' was here
This I fix by changing external/selinux/libsepol/include to external/libsepol/include in:
Code:
# external/busybox/Android.mk:
BUSYBOX_C_INCLUDES = \
$(BB_PATH)/include $(BB_PATH)/libbb \
bionic/libc/private \
bionic/libm/include \
bionic/libc \
bionic/libm \
libc/kernel/common \
external/libselinux/include \
external/libsepol/include \
...
... and at this point, ... make ... will fail with:
Code:
external/busybox/android/librpc/pmap_rmt.c:235:8: warning: implicit declaration of function 'inet_makeaddr' [-Wimplicit-function-declaration]
external/busybox/android/librpc/pmap_rmt.c:238:8: warning: implicit declaration of function 'inet_netof' [-Wimplicit-function-declaration]
external/busybox/android/librpc/pmap_rmt.c:235:19: error: incompatible types when assigning to type 'struct in_addr' from type 'int'
Here I found stackoverflow.com/questions/27762475/incompatible-types-when-assigning-to-type-struct-in-addr-from-type-int/27763398, which notes:
The error message is misleading, the function is simply missing from earlier versions of the NDK.
Click to expand...
Click to collapse
So, as a final try, I tried forcing a newer NDK through an environment variable, as in:
Code:
NDK_HOME=/path/to/android-ndk-r10e \
ANDROID_PRE_BUILD_PATHS=/path/to/jdk1.6.0_45/bin \
ANDROID_JAVA_TOOLCHAIN=/path/to/jdk1.6.0_45/bin \
JAVA_HOME=/path/to/jdk1.6.0_45 \
PATH=/path/to/jdk1.6.0_45/bin:$PATH \
make -j3 recoveryimage
... but this fails in exactly the same manner (with "implicit declaration of function 'inet_makeaddr'", etc).
At this point, I really don't know what I should do... Should I:
Try to use the BQ Kernel sources for this device (even if mentioned above, I haven't used them anywhere yet) somewhere (say clone them in the Android tree)? If so - where?
Try to find a busybox for AOSP 4.1.2? If so - what version is OK, and where do I find it?
Try to bump the AOSP repo version up from 4.1.2? If so, what would be the minimum version required so this builds - and would I have to wait 14+ hours again?
... or is there anything else I could try?
Again, I'm mostly interested in building MultiROM and the recovery image (TWRP?) required for it on the Aquaris E5 - but it would be nice to know how to build TWRP proper recovery image as well...
Thanks in advance for any hints...
Me too
I am planning on doing almost the exact same thing you're trying! But I have a few questions:
Have you tried adding --depth 1 to your repo command to reduce the download time?
Have you seen https://forum.xda-developers.com/showthread.php?t=2329228 ? Mainly the local manifest, also to reduce download time
Why do you want to use the lowest version possible? The TWRP device tree is for Android 5.1, so I'll be using that version.
Related
[TUT] CM6 / CM7 / Kernel Compile Step by Step
1) You need the following: -Python 2.4 -- 2.7, which you can download from python.org. Or: Code: $ sudo add-apt-repository ppa:fkrull/deadsnakes $ sudo apt-get update $ sudo apt-get install python2.5 -JDK 6 if you wish to build Gingerbread or newer or -JDK 5 for Froyo or older. You can download both from java.sun.com. Or: Code: $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" $ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner" $ sudo apt-get update $ sudo apt-get install sun-java6-jdk- Git 1.5.4 or newer. You can find it at git-scm.com. Or: Code: $ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install git-core-(optional) Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc. Download from valgrind.org. Or: Code: $ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install valgrind 2) Install required packages. Code: $ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev 3) Download the repo: Code: $ mkdir ~/bin $ PATH=~/bin:$PATH $ curl http://android.git.kernel.org/repo > ~/bin/repo $ chmod a+x ~/bin/repo6) Initialize the repo: Code: $ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORYF or master branch: Code: $ repo init -u git://android.git.kernel.org/platform/manifest.git For specific branch other than Gingerbread you would put in Donut, Eclair, Froyo, or Gingerbread where it currently says "gingerbread" without the parenthesis: Code: $ repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread 4) When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions. 5) Gather the files: Code: $ repo sync 6) Verify and insert public key block: Code: $ gpg --import Code: -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.2.2 (GNU/Linux) mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu 5hOF9KXwCgkxMD u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEa UA6U90sEoVks0Z wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDya TrkANjdYY7p2cq /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJn uyvoizl9/I1S5 jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4 MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9 b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGh lIEFuZHJv aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cm lidXRpb25AYW5k cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCA MEFgIDAQIeAQIX gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tg CdFfQYiHpYngkI 2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71 MnrF6fj+Udtb5+ OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDg pqt7Y7s KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior 6b8LrZrAhkqDjA vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmU tkBszwo G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+Bmr EOeCUOAJ9qmR0l EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KL M= =Wi5D -----END PGP PUBLIC KEY BLOCK----- 7) After copying and pasting the public key block press Crtl+D to end the input. 8) Compiling: Code: $ source build/envsetup.sh Or: Code: $ . build/envsetup.sh 9) Issue: Code: $ lunch 10) Pick your poison. 11) Now issue: Code: $ make 12) Now just cross your fingers and hope it all works out! 13) Issue this command to create a flashable zip: Code: $ make otapackage Or if you want to test on an emulator: Code: $ emulator 15) If all went well you can either run your build on an emulator or flash it on a device. Code: Please note that you have already selected your build target with lunch, and it is unlikely at best to run on a different target than it was built for. ~How To Add A Device To The List~ 1) Find the github for your device you wish to add. (For me it is the HTC Hero CDMA) 2) Now navigate to the location you are going clone the device tree to: Code: $ cd WORKING_DIRECTORY/device/htc3) Clone the github device tree from remote to local: (The heroc would be whatever you want that folder to be named so make sure it is whatever standard name would be for your device, example: Nexus One [Passion], Nexus S [Crespo], Motorola Droid [Sholes], HTC Incredible [Inc], etc.) Code: git clone git://github.com/wjb/android_device_htc_heroc.git -b gingerbread heroc 3) Now navigate into the folder: Code: $ cd heroc 4) Setup Device Specific Make Files: Code: $ ./setup-makefiles.sh 5) Prepare To Copy Device Proprietary Files To Vendor Tree: Code: $ cd prebuilt 6) Copy Proprietary Files To Vendor Tree: Code: $ cp -r proprietary WORKING_DIRECTORY/vendor/htc/heroc 7) Navigate back to your home directory for building: Code: $ cd ~/WORKING_DIRECTORY 8) Prepare To Compile: Code: $ source build/envsetup.sh Or: Code: $ . build/envsetup.sh 9) Get your list of devices: Code: $ lunch 10) Pick your poison. 11) Now compile: Code: $ make Or if you want a flashable zip: Code: $ make otapackage Compiling kernel: You will need sdk / ndk packages from Google: mkdir KERNEL_DIRECTORY cd to KERNEL_DIRECTORY Code: ARCH=arm CROSS_COMPILE=???/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make semc_?????_defconfig or Unpack config.gz to KERNEL_DIRECTORY as .config from kernel.sin --- how? Simple use hexeditor and search two times for gzip magic 1F8B08 cut all before that and you have config.gz then ARCH=arm CROSS_COMPILE=???/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make Compiling invidual packages: Code: make [ module name ]
Why this so down this is a huge guide no one interested?
THANKS Man I was wondering how to do this, thanks a lot this guide will help many people. And others will understand the hard work that involves creating a custom kernel or rom. This guide is for debian based distributions Great job aZuZu Sent from my X10a using xda premium
Establishing Android Build Enviroment under openSuse Leap
Tutorial how set up Android Build Enviroment on openSUSE Leap If this help's u hit Thanks! 1) If you don’t have fresh installed openSUSE Leap first you need remove all Java installation, many people might have the wrong version of Java installed. Code: sudo zypper remove openjdk-* icedtea-* icedtea6-* Follow the on-screen instructions to remove any stray Java versions. Otherwise, move on to the next step. 2) Install the main build tools with this command: Code: sudo zypper install bison curl flex git gnupg gperf libesd-devel liblz4-1_4 ncurses-devel libSDL-devel python-wxWi dgets-devel libxml2-2 libxml2-tools lzop java-1.7.0-openjdk java-1.7.0-openjdk-devel schedtool squashfs libxslt1 zip zlib-devel make gcc-c++ Appendx A to 2: To setup maven which is needed for building: 1. Download maven: wget http://mirrors.ibiblio.org/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz 2. Extract the file tar -xvzf apache-maven-3.3.9-bin.tar.gz /tmp 3. Move to /opt/ folder sudo mv /tmp/apache-maven-3.3.9 /opt/ 4. Update environment, cd to home directory cd ~ nano .bashrc 5. Append the path export PATH=$PATH:/opt/apache-maven-3.3.9/bin 6. Reload source .bashrc 7. Verify maven mvn --version Appendix B to 2: For 64-bit system also install: sudo zypper install glibc-devel-32bit ncurses-devel-32bit readline-devel-32bit libz1-32bit >> build-essential << is Ubuntu meta package which in openSUSE is devel_basis And u can install it by command sudo zypper install --type pattern devel_basis Select y to what it is offering to install. 3) Repo install... mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo Appendix to 3: To fix repo sync u will need install this: sudo zypper install libpth20-32bit maybe this to: sudo zypper install openjdk-8-devel 4) Use your favorite text editor to open ~/.bashrc - I like nano: Code: nano ~/.bashrc By default nano is not installed so install it by command: sudo zypper install nano 5) At the very bottom (use the Page Down key) paste this code to a new line: Code: export PATH=~/bin:$PATH export USE_CCACHE=1 6) Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Restart bash: Code: source ~/.bashrc 7) In the terminal, navigate to where you would like to download the Android source code. The commands below will make it in your home folder. Code: mkdir ~/android cd ~/android 8) Now you're going to initialize the repo. This is where you decide the flavor of Android you want to build, i.e. AOKP, CyanogenMod, AOSP etc. For the purposes of this tutorial, here's the command for Cyanogenmod 13 (Marshmallow) : Code: repo init -u https://github.com/CyanogenMod/android.git -b cm-13.0 9) Time to get the source, many gigabytes of downloading await. Don't worry, it's automated. It's the last one! Code: repo sync Check back periodically every hour or so. It all depends on how fast your connection is. That's it! Everything should be ready to go.
Thanks for the guide In Tumbleweed, the package is liblz4-1_7 There is a typo, it should be python-wxWidgets-devel Also, the link to repo should be complete: Code: http://commondatastorage.googleapis.com/git-repo-downloads/repo
Thanks does it worth to have a separate user for builds?
Android Build Enviroment for openSUSE tumbleweed early 2019 Sorry for necromancing this old thread, but I've recently switched to openSUSE and these are the dependencies that I've used to successfully build LineageOS-16.0.: Code: sudo zypper install --type pattern devel_basis sudo zypper install bison java-1_8_0-openjdk java-1_8_0-openjdk-devel SDL-devel python-wxWidgets-devel lzop schedtool squashfs glibc-devel-32bit ncurses-devel-32bit ncurses5-devel-32bit readline-devel-32bit ccache libz1-32bit python-xml bc You can find maven here: https://software.opensuse.org/package/maven and android-tools here: https://software.opensuse.org/package/android-tools Dependencies already included by default in my system (not included in "devel_basis") that may you don't have but you need: Code: gpg2 liblz4-1 libxml2-2 libxml2-tools libxslt-tools zip Just sharing because this post will (probably) save some time to someone in the same situation in early 2019.
_mone said: Sorry for necromancing this old thread, but I've recently switched to openSUSE and these are the dependencies that I've used to successfully build LineageOS-16.0.: Code: sudo zypper install --type pattern devel_basis sudo zypper install bison java-1_8_0-openjdk java-1_8_0-openjdk-devel SDL-devel python-wxWidgets-devel lzop schedtool squashfs glibc-devel-32bit ncurses-devel-32bit ncurses5-devel-32bit readline-devel-32bit ccache libz1-32bit python-xml bc You can find maven here: https://software.opensuse.org/package/maven and android-tools here: https://software.opensuse.org/package/android-tools Dependencies already included by default in my system (not included in "devel_basis") that may you don't have but you need: Code: gpg2 liblz4-1 libxml2-2 libxml2-tools libxslt-tools zip Just sharing because this post will (probably) save some time to someone in the same situation in early 2019. Click to expand... Click to collapse Thanks for this. I'm still getting an error and wondering what SSL packages you have installed? I'm obviously missing one below. EDIT: i kept installing SSL packages until it worked, can't remember which one did the trick but it seems it's chugging along now /run/media/david/4d58d760-2359-46fb-b95b-1b374cb34428/android/lineage/kernel/oneplus/sdm845/scripts/extract-cert.c:21:10: fatal error: openssl/bio.h: No such file or directory #include <openssl/bio.h> ^~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [scripts/Makefile.host:101: scripts/extract-cert] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [/run/media/david/4d58d760-2359-46fb-b95b-1b374cb34428/android/lineage/kernel/oneplus/sdm845/Makefile:558: scripts] Error 2 make[1]: Leaving directory '/run/media/david/4d58d760-2359-46fb-b95b-1b374cb34428/android/lineage/out/target/product/fajita/obj/KERNEL_OBJ' make: *** [Makefile:152: sub-make] Error 2 make: Leaving directory '/run/media/david/4d58d760-2359-46fb-b95b-1b374cb34428/android/lineage/kernel/oneplus/sdm845' [ 0% 70/94167] //external/protobuf:aprotoc clang++ src/google/protobuf/compiler/javanano/javanano_extension.cc [linux_glibc] ninja: build stopped: subcommand failed. 12:41:48 ninja failed with: exit status 1
[Help] Building from source issue (CopperheadOS)
Host Machine: MacBook Pro Retina 16GB Ram, 2.8GHz processor with 4 cores Virtual Machine: 8 vCPUs, 30GB RAM, Ubuntu 16.04.1 LTS (Google Cloud Platform) using THIS guide. I am attempting to build CopperheadOS from source so I can apply a signature spoofing patch and utilize MicroG. I originally tried this on Ubuntu 14.04 VM via Virtualbox but ran into the same error below. I've listed my terminal commands at the bottom of this post for reference as well. Makefile:130: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 make: Leaving directory '/home/"user.name"/copperheados-N4F26J.2017.01.04.05.44.59/kernel/huawei/angler' [ 11% 5247/44926] Building with Jack: out/target/common/...LIBRARIES/framework_intermediates/with-local/classes.dex ninja: build stopped: subcommand failed. build/core/ninja.mk:148: recipe for target 'ninja_wrapper' failed make: *** [ninja_wrapper] Error 1 #### make failed to build some targets (15:32 (mm:ss)) #### Click to expand... Click to collapse I read online that this is a Jack issue, and tried the following: Code: export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 - XX:+TieredCompilation -Xmx30g" ./prebuilts/sdk/tools/jack-admin kill-server ./prebuilts/sdk/tools/jack-admin start-server The same error output again. Setup Build Environment & Download Source Files Code: sudo -s sudo apt-get update sudo apt-get install openjdk-8-jdk sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-mul tilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip mkdir ~/bin PATH=~/bin:$PATH curl https://storage.googleapis.com/git-repo-downloads/repo chmod a+x ~/bin/repo git config --global user.name “firstname” git config --global user.email “[email protected]” mkdir copperheados-N4F26J.2017.01.04.05.44.59 cd copperheados-N4F26J.2017.01.04.05.44.59 repo init -u https://github.com/CopperheadOS/platform_ma nifest.git -b refs/tags/N4F26J.2017.01.04.05.44.59 repo sync -j16 Download and apply MicroG Patch Code: curl -o android_frameworks_base-N.patch https://raw.githubusercontent.com/microg/android_pac kages_apps_GmsCore/master/patches/android_frameworks_base-N.patch mv android_frameworks_base-N.patch spoof.patch mv spoof.patch ~/copperheados N4F26J.2017.01.04.05.44.59/frameworks/base cd ~/copperheadosN4F26J.2017.01.04.05.44.59/frameworks/base git apply spoof.patch Build Code: cd ~/copperheados-N4F26J.2017.01.04.05.44.59 source build/envsetup.sh export LANG=C unset _JAVA_OPTIONS export BUILD_NUMBER=$(date --utc +%Y.%m.%d.%H.%M.%S) export DISPLAY_BUILD_NUMBER=true chrt -b -p 0 $$ choosecombo release aosp_angler user make target-files-package -j20 ERROR (listed in beginning of post) outputs. Code: export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 - XX:+TieredCompilation -Xmx30g" ./prebuilts/sdk/tools/jack-admin kill-server ./prebuilts/sdk/tools/jack-admin start-server ERROR outputs again. I tried all the steps above again with Code: make target-files-package -j16 wondering if I was trying to use too many parallels processes, but I received the same error. I had the same problem when I setup Ubuntu in VirtualBox with 10GB RAM and 3 cores (I even did -j3 since I didn't know how high I should go).
Building Lineageos from source. Kernel issues after config update
Hi all I'm trying to build a Lineageos 14.1 from source, as i'm trying to add support for a USB Wifi card. I'm using the "UNOFFICIAL Lineage OS for Samsung Galaxy S5+ / G901F / kccat6xx" source originally worked on by sktjdgns1189 then forked to 14.1 by ionkiwi and github-cygwin on git hub. I've had some degree of success compiling the source code to an installable file. However. As soon as i start messing with the kernel config, even if i open the menuconfig making no changes but save and recompile using the following process... Step1 make ARCH=arm cyanogenmod_kccat6_defconfig VARIANT_DEFCONFIG=dummy_defconfig SELINUX_DEFCONFIG=selinux_defconfig Click to expand... Click to collapse and open the config page using... Step2 make ARCH=arm menuconfig Click to expand... Click to collapse Make no changes but save and quit then copy the file back. Step3 cp ~/cm14.1/kernel/samsung/kccat6/.config ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/cyanogenmod_kccat6_defconfig Click to expand... Click to collapse and recompile with Step4 make -j16 ARCH=arm Click to expand... Click to collapse All the above works without any problems and the kernel compile completes successfully. However. when I try and create the new LineageOS image, fully recompiling the whole ROM with the new kernel config, i get the following errors. Scripts/selinux/genheaders/genheaders In file included from /home/simon/cm14.1/kernel/samsung/kccat6/include/linux/types.h:5:0, from /home/simon/cm14.1/kernel/samsung/kccat6/include/linux/mod_devicetable.h:11, from /home/simon/cm14.1/kernel/samsung/kccat6/scripts/mod/devicetable-offsets.c:2: /home/simon/cm14.1/kernel/samsung/kccat6/include/uapi/linux/types.h:4:23: fatal error: asm/types.h: No such file or directory #include <asm/types.h> ^ compilation terminated. /home/simon/cm14.1/kernel/samsung/kccat6/scripts/mod/Makefile:34: recipe for target 'scripts/mod/devicetable-offsets.s' failed make[3]: *** [scripts/mod/devicetable-offsets.s] Error 1 make[3]: *** Waiting for unfinished jobs.... Click to expand... Click to collapse This is really messing with my head. The LineageOS build all compiles fine, up until try and save a config (without changes). What am i doing wrong? The kernel compiles without errors on it's own, but not as part of the LineageOS brunch build. I can fix the types.h error by creating a symbolic link for generic-asm to asm. but then i hit more errors later in other modules. The weired thing is it all compiles out of the straight from the repo I only run into problems when I've recompiled the kernel. Even without the changes to the config files it imports in step 1 above. When i get the kernel to successfully recompile with LineageOS, I want to add the following. "Networking support" -> "Wireless" <*> Common routines for IEEE802.11 drivers <*> Generic IEEE 802.11 Networking Stack (mac80211) "Device Drivers" -> "Network device support" -> "Wireless LAN" [*] Realtek 8187 and 8187B USB support "Device Drivers" -> "Network device support" -> "Wireless LAN" -> "Realtek wireless card support" [*] Debugging output for rtlwifi driver family (NEW) ¦ ¦ <*> Realtek RTL8192CE/RTL8188CE Wireless Network Adapter <*> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter Click to expand... Click to collapse Can anyone point me in the right direction?
My build notes so far... (I've had to deface the u.r.l.s below to post as i'm under 10 remove the ~'s #How to build an Android Kernel #1. Install Ubuntu... #2. add java add-apt-repository ppa:webupd8team/java apt-get update sudo apt-get install openjdk-8-jre sudo apt-get install openjdk-8-jdk #3. Install compilers install sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \ lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \ libgl1-mesa-dev libxml2-utils xsltproc unzip sudo apt-get install python-networkx sudo apt-get install lzop #4. CONFIGURE GIT mkdir ~/bin c~u~r~l [ u~r~l ]h~t~t~p~s:~/~/storage.googleapis~c~o~m/git-repo-downloads/repo [ ~/~u~r~l] > ~/bin/repo chmod a+x ~/bin/repo git config --global user.name "YourGitname" git config --global user.email "[email protected]" #5. Add your source mkdir cm14.1 cd cm14.1 repo init -u .g~i~t~:~/~/~github.c~o~m/LineageOS/android.git -b cm-14.1 #7. Add the unoffical stuff from kccat6xx git repos mkdir ~/.repo/local_manifests #8 create this file here paste the content of this xml into the file to get all the samsung device drivers for this device. #[~u~r~l~]~h~t~t~p~s~:~/~/~github.c~o~m/github-cygwin/kccat6xx-roomservice.git[~/~u~r~l] gedit ~/cm14.1/.repo/local_manifests/roomservice.xml #9 Run the repo sync to get all the source locally. This takes ages to download. ~/bin/repo sync #10. Settup environment vars to cross compile the kernel export PATH=~/cm14.1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin:$PATH export ARCH=arm export SUBARCH=arm export CROSS_COMPILE=arm-eabi- #9. initialise the environment source build/envsetup.sh #10. run breakfast breakfast kccat6xx ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ START - This block breaks it the compile but leave it out and the ROM compiles~~~~~~~~~~~~~~~~ ##11. Backup your original Kernel config #mkdir ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/backups #cp ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/*kccat6* ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/backups #cp ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/*apq8084* ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/backups ##12. Make config files #cd ~/cm14.1/kernel/samsung/kccat6 #make ARCH=arm cyanogenmod_kccat6_defconfig VARIANT_DEFCONFIG=dummy_defconfig SELINUX_DEFCONFIG=selinux_defconfig ##~~~~ These are the changes i want to make - even if i don't save and exit from the menuconfig it fails~~~~~~ # ##13. Now configure the kernel with any changes you want to make# # make ARCH=arm menuconfig # # "Networking support" -> "Wireless" # <*> Common routines for IEEE802.11 drivers # <*> Generic IEEE 802.11 Networking Stack (mac80211) # # "Device Drivers" -> "Network device support" -> "Wireless LAN" # [*] Realtek 8187 and 8187B USB support # # "Device Drivers" -> "Network device support" -> "Wireless LAN" -> "Realtek wireless card support" # [*] Debugging output for rtlwifi driver family (NEW) # <*> Realtek RTL8192CE/RTL8188CE Wireless Network Adapter # <*> Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter # ##~~~~ These are the changes i want to make - even if i don't save and exit from the menuconfig it fails~~~~~~ ##14. Copy your new config to the kernel config directory for your device #cp ~/cm14.1/kernel/samsung/kccat6/.config ~/cm14.1/kernel/samsung/kccat6/arch/arm/configs/cyanogenmod_kccat6_defconfig ##15. recompile the kernel #make -j16 ARCH=arm #go back to the top of your stack in my case ~/cm14.1 #cd ~/cm14.1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ END - This bit breaks it the compile but leave it out and the ROM compiles ~~~~~~~~~~~~~~~~~~~~~ #16. Compile the ROM brunch kccat6xx #If you left out steps 11 - 15 the ROM will compile. How do I compile the new ROM with my changes successfully? why do i get loads #of errors when i change the kernel from it's default. Other examples where people have done this seem to work? Click to expand... Click to collapse Any ideas greatly appreciated. I've hit a brick wall and google no longer appears to be my friend
Have you got your solution ?
Upstream arm64 kernel for Raspberry Pi 3
Hi all If you just need Raspberry Pi 3 to run headless linux and unleash its full 64bit power then you can compile vanilla kernel (kernel.org) for Raspberry Pi 3 using this tutorial. YOU NEED TO USE THIS WITH ARM64 LINUX DISTRIBUTION I don't know if it's my custom distribution's fault or kernel fault but when I use arm64 kernel on Raspberry Pi's Github then it's panic because fs driver on heavy load. This tutorial doesn't use u-boot for booting the kernel, instead I use the firmware as it is. This tutorial has been tested on Ubuntu 16.10, 17.04 host and you just need to copy and paste, it will work. First of all, you need to setup build environment by using command below (maybe not all of these are necessary but this is how I usually setup my Android build environment and it's work for kernel build too): Code: sudo apt update sudo apt install -y bison bc build-essential flex git-core gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libxml2 libxml2-utils lzop schedtool xsltproc zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev Now you need to get the aarch64 toolchain, here I'll use Linaro because it will somewhat improve performance but you can use the gcc-aarch64-linux-gnu if you want. This code will download Linaro 6.3.1 and extract it to /opt/ for use later on: Code: wget http://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz sudo tar -xvf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/ Now you need to clone kernel source code, this will takes some time on slow connection even though I did make it only clone the latest commit (shadow clone) but without clone the whole history: Code: git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --depth=1 -b linux-4.10.y You can change the linux-4.10.y to another branch if you want, this branch clone will give you the latest version of that particular kernel version (4.10). Now start the compilation, here I'm using a build machine with 14 cores, you can replace -j14 with your CPU core number for faster build, don't set it to higher than your real CPU core or it will slow your machine down: Code: cd linux-stable mkdir MODULES BOOT # # Export necessary variable # export CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- export ARCH=arm64 # # Make arm64 default defconfig # make defconfig -j14 # # You must enable FB_SIMPLE or it will not boot # sed -i 's/# CONFIG_FB_SIMPLE is not set/CONFIG_FB_SIMPLE=y/g' .config # # Here I enable ethernet driver as built-in because you'll need it in some situation like kernel module not loaded # sed -i 's/CONFIG_USB_USBNET=m/CONFIG_USB_USBNET=y/g' .config sed -i 's/CONFIG_USB_NET_SMSC95XX=m/CONFIG_USB_NET_SMSC95XX=y/g' .config # # Disable these heavy module which we will not use it at all # sed -i 's/CONFIG_DRM_NOUVEAU=m/# CONFIG_DRM_NOUVEAU is not set/g' .config sed -i 's/CONFIG_DRM_TEGRA=m/# CONFIG_DRM_TEGRA is not set/g' .config # # Making the modules, copy it to ./MODULES # make modules -j14 make modules_install -j14 INSTALL_MOD_PATH=MODULES/ # # Making the kernel and dtbs # make Image dtbs -j14 # # It's compiled, copy it to ./BOOT for easy to work with # cp ./arch/arm64/boot/Image ./BOOT/Image cp ./arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb ./BOOT/ You should have all the necessary file from build kernel in 2 directory (BOOT, MODULES) if nothing wrong happens. [INSTALL KERNEL] Plug the MicroSDcard of Raspberry Pi 3 to your computer and copy ./BOOT/Image and ./BOOT/bcm2837-rpi-3-b.dtb to partition #1 (vfat) Edit the config.txt and add lines below, edit if already exist, this will: active arm64 mode, use device_tree for boot kernel, use kernel named Image: Code: arm_control=0x200 device_tree=bcm2837-rpi-3-b.dtb kernel=Image [INSTALL MODULES] Now you have to mount the Raspberry Pi 3 Linux OS partition (usually is partition #2) to your system to copy file into it Make backup and delete every directory in /lib/modules/ of OS partition Copy ./MODULES/lib/modules/* to /lib/modules/ of OS partition using root Now it's basically done, unmount/safely eject the sdcard and plug it to your Raspberry Pi 3, boot it up. Modules might not loaded automatically, run this command on Raspberry Pi 3 shell: Code: sudo find "/lib/modules" -mindepth 1 -maxdepth 1 -type d | while read DIR; do echo ${DIR}; BASEDIR=$(basename "${DIR}"); echo " *** depmod ${BASEDIR}"; depmod -b "/" -a "${BASEDIR}"; done Now modules should be loaded and will be loaded automatically on next boot. Disclaimer: - Only Kernel 4.9 and above are supported Raspberry Pi 3 AArch64 - Wifi/Bluetooth will not work since driver still haven't implemented - Other function might not work Tested/working: - USB - Ethernet - HDMI - UART - GPU acceleration