I am trying to compile kernel for Oneplus5 with Lineage OS 15.1 custom ROM installed. I am using google ndk toolchains for compiling kernel. I extracted the kernel source code from Lineage OS source code, also tried compiling stock ROM kernel.
After few heat and trials and fixing some files in the source code of kernel finally I managed to compile it successfully! After compilation is completed I got Image,Image.gz files in arch/arm64/boot directory.
But when I tried to flash the kernel image from TWRP recovery, device always boot into fastboot mode and got stuck there. What is the issue and what can I do to make it work.
Try running mka bootimage, then flashing the resulting boot.img with fastboot flash boot boot.img.
The slightly longer version, based on the instructions at https://wiki.lineageos.org/devices/cheeseburger/build:
apt install adb fastboot bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev openjdk-8-jdk python unzip
mkdir -p ~/bin
mkdir -p ~/android/lineage
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
echo 'PATH="$HOME/bin:$PATH"' >> .profile
echo 'export LC_ALL=C' >> .profile
git config --global user.email "you#example.com"
git config --global user.name "Your Name"
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-15.1
repo sync
source build/envsetup.sh
# use extract-files.sh or follow https://gist.github.com/fourkbomb/261ced58cd029c5f7742350aafdd9825
breakfast cheeseburger
mka bootimage
If the mka bootimage step runs without errors but doesn't generate a boot.img, try running mka bacon for a few minutes, then abort it and re-run mka bootimage.
The above commands will use LineageOS' default kernel for the device, in ./android/lineage/kernel/oneplus/msm8998. You can simply make your changes there, or place a whole new kernel source in that directory. In the latter case, make sure to place a lineage_oneplus5_defconfig file in arch/arm64/configs.
Related
I'm using Pydroid3 and would like to use Git in the Pydroid Terminal.
In my Termux terminal I was able to install Git as described here: Python and Git on Android
The git command is now only recognized in the Termux Terminal but not in Pydroid :(. Installation of Git with apt-get in the Pydroid Terminal is not possible.
Has anybody managed to install Git for Pydroid?
This is working for me; you might need to tweak the curl or configure commands if things fail. I haven't looked into ssh for now, only https.
# enter dev folder
cd $HOME
# set a prefix variable for convenience
export PREFIX="$(readlink -f "$PKG_CONFIG_PATH"/../..)"
# if you want git-remote-https, first build and install curl
curl -LO https://curl.se/download/curl-7.77.0.tar.bz2
tar -jxvf curl-7.77.0.tar.bz2
cd curl-7.77.0
./configure --prefix="$PREFIX" --disable-static --with-openssl --with-ca-path=/system/etc/security/cacerts --with-ca-bundle="$SSL_CERT_FILE"
make -j8 install
cd ..
# download and enter git sources
curl -LO https://www.kernel.org/pub/software/scm/git/git-2.32.0.tar.gz
tar -zxvf git-2.32.0.tar.gz
cd git-2.32.0
# reconfigure git for platform
./configure --prefix="$PREFIX" --without-tcltk --disable-pthreads LDFLAGS="-lssl -lcrypto -lz"
# if you didn't install curl, download autoconf's install script since there is no coreutils on android
# curl "http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob_plain;f=build-aux/install-sh;hb=HEAD" -o install
# otherwise copy curl's install script in
cp ../curl-*/install-sh install
# build and install git
make -j8 install INSTALL="sh $(pwd)/install"
I am working on Kivy framework. I have some sample of Kivy which has .py extension which I want to convert to .apk files. I want to check whether these working on Android or not.
I have some information about this. We have two ways to build an .apk file:
Using Python for Android,
Using Buildozer.
But Buildozer is only supported on Linux. I thought it has some problems on Windows.
Hence, I want to use Python for Android. But I have no idea how to approach this one.
Have anyone tried this one.
You can use VirtualBox Get it here and any Linux Distribution such as Ubuntu Ubuntu.
After installing Ubuntu to your Virtualbox you can use below commands:
Run these commands on Terminal
sudo apt install git
sudo apt install python3-pip
git clone https://github.com/kivy/buildozer.git
cd buildozer
sudo python3 setup.py install
Now, navigate to your project directory using cd (or) goto your Project directory, RightClick -->select 'Open in terminal' and in Terminal type:
buildozer init
Above Command creates a buildozer.spec file controlling your build configuration. You should edit it appropriately with your app name, file extensions used in the project, external dependencies etc. After configuring your buildozer.spec fille run below commands:
sudo apt update
sudo apt install -y git zip unzip openjdk-8-jdk python3-pip autoconf libtool pkg-config zlib1g-dev libncurses5-dev libncursesw5-dev libtinfo5 cmake libffi-dev libssl-dev
pip3 install --user --upgrade Cython==0.29.19 virtualenv # the --user should be removed if you do this in a venv
sudo pip3 install cython #(optional) If you got any Error as Cython not Found, use this
which buildozer
Above command is to check buildozer was added to your PATH), If no results found, add the following line at the end of your ~/.bashrc file--> export PATH=$PATH:~/.local/bin/
buildozer appclean
buildozer android debug
If you are asked for any licence agreement type y and click Enter
Once this process completes you will get a .apk file in your project directory bin/yourapp.apk
Kivy themselves used to have a virtual machine prepared with everything installed ready to go!
For some reason they stopped, now you have to install the Virtual Machine yourself.
You can see how to do this here
here is a link you can find everything that is related to getting .Apk files
https://python-for-android.readthedocs.io/en/latest/quickstart/#usage
So I could finally get a decent output in a shell about Kivy Python-For-Android installation and distro build. The thing is that I cannot seem to get the compass example to work at all. A force close is activated right after running the app.
I'm using the latest toolchain and the old doesn't seems to work... An error about old chain not supported any more.
The thing is that I'm using the latest version of SDK and NDK. The documentation ask for android API 14 but it's not found on the android manager repository. All APIs are present but not API 14 so I use API 17.
The installation script I manage to put together with things out of the current doc to make it work on: Ubuntu 15.10 x64
#### Tested On x64 System ####
# Enable Restricted, Universe & Multiverse Repositories
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu$(lsb_release -sc) main universe restricted multiverse"
# Add x86 Packets
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y build-essential ccache git zlib1g-dev python2.7 python2.7-dev libncurses5:i386 libstdc++6:i386 zlib1g:i386 openjdk-7-jdk unzip ant python-pip cython autoconf libtool
sudo pip install virtualenv
git clone https://github.com/kivy/python-for-android.git
cd python-for-android
python setup.py install
export ANDROIDSDK="/media/$(logname)/EXTSave/android-sdk-linux"
export ANDROIDNDK="/media/$(logname)/EXTSave/android-ndk-r11b"
export ANDROIDAPI=17
export ANDROIDNDKVER=11
# EXTSave is an HDD Partition
python-for-android apk --private /media/$(logname)/EXTSave/compass --requirements=python2 --package=org.pirate.kaizoku --name="Kaizoku" --version=0.1
How can I compile an example or something? Is there something wrong?
Since I'm no professional programmer I forgot/didn't know how to check the logs but after more searching I finally found my error! The program was not not able to import the kivy framework. I forgot to add it in:
python-for-android apk --private /media/$(logname)/EXTSave/compass --requirements=python2,sdl,kivy --package=org.pirate.kaizoku --name="Kaizoku" --version=0.1
Since the original installation code is working I will make some changes for automation and leave it here for future reference for faster approach to the framework.
For future problems use the logs to check any problems:
python-for-android logcat
I just built AOSP 6.0 for hammerhead and attempted to flash it. My phone froze at the Google logo and refused to boot. I'm assuming I need to use the proprietary binaries found here https://developers.google.com/android/nexus/drivers
How would I extract these and put them in to my build? Thanks.
Be certain to download the Nexus 5 binaries that match the version of AOSP that you're building. For example, if you're building the most recent version of AOSP, when you initialized your repo you entered this command:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r72
Take that last branch code (everything after '-b') android-6.0.1_r72 and search for it over here:
https://source.android.com/source/build-numbers.html#source-code-tags-and-builds
It matches build M4B30X
Now, take that build code M4B30X and search for it over here:
https://developers.google.com/android/nexus/drivers
Download the corresponding binaries:
$ cd ~/Downloads
$ wget https://dl.google.com/dl/android/aosp/broadcom-hammerhead-m4b30x-7c7b231f.tgz
$ wget https://dl.google.com/dl/android/aosp/lge-hammerhead-m4b30x-74fa3aa5.tgz $ wget https://dl.google.com/dl/android/aosp/qcom-hammerhead-m4b30x-158606cf.tgz
Verify the integrity of each download:
$ echo "01a03cf36b20ee2460d108c1d199f4b012b084368cddfbff1e40ff8270b54d6f broadcom-hammerhead-m4b30x-7c7b231f.tgz" | sha256sum -c
$ echo "a533f4c82d430181b97ab2321acf10ab1e2b126de7bb15437c969331541af7cb lge-hammerhead-m4b30x-74fa3aa5.tgz" | sha256sum -c
$ echo "9a2760bda79e3be7bbe7203c05273c80b0d043d9aaf15be20361e35b16ef8905 qcom-hammerhead-m4b30x-158606cf.tgz" | sha256sum -c
Extract each gzip file:
$ tar xzvf broadcom-hammerhead-m4b30x-7c7b231f.tgz
$ tar xzvf lge-hammerhead-m4b30x-74fa3aa5.tgz
$ tar xzvf qcom-hammerhead-m4b30x-158606cf.tgz
Execute the resulting self-extracting files from the source tree's root folder(~/AOSP)
$ cd ~/AOSP
$ ~/Downloads/extract-broadcom-hammerhead.sh
$ ~/Downloads/extract-lge-hammerhead.sh
$ ~/Downloads/extract-qcom-hammerhead.sh
After executing each file hit the Enter key once and then hit
the Space bar until you reach the end of each document.
At the end of each document type:
I ACCEPT
and hit the Enter key.
To accommodate the new binaries you must initiate a full rebuild, so set the
environment:
$ ./ build/envsetup.sh
$ lunch aosp_hammerhead-userdebug
And make the synthetic target 'clobber' in order to clean:
$ make clobber
Now rebuild:
(If you're running a Core2Duo)
$ make -j4
(Or, if you're running something bigger)
$ make -j16
Uncompress the downloaded files, you will get bash files. Put all these files in the root directory of your AOSP project and execute them. You will have to accept the licenses and the binaries will be extracted in the right directory.
After this step. In the AOSP root directory, execute :
make clobber
It will clean the current build (out/**). It is needed for the make to notice the changes regarding the AOSP build official procedure.
Then you can compile again the sources.
make -j4
(or j8/j16 regarding your CPU threads number)
I want to install a different kernel on my Samsung i9300 (some config flags enabled)
So far I have installed the custom ROM
Slim-4.4.2.build.3-OFFICIAL-3091
It uses the following kernel version so far:
$ adb shell
shell#android:/ $ uname -a
Linux localhost 3.0.80+ #1 SMP PREEMPT Sat Feb 15 15:10:26 CET 2014 armv7l GNU/Linux
The kernel version of my source from which I create my kernel.zip has a newer version:
.../kernel_samsung_smdk4412$ gedit Makefile
VERSION = 3
PATCHLEVEL = 0
SUBLEVEL = 80
EXTRAVERSION =
NAME = Sneaky Weasel
...
I used the following toolchain to build the kernel successfully:
1)
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7
2)
sudo gedit .bashrc
export PATH=${PATH}:~/arm-linux-androideabi-4.7/bin
3)
cd /kernel_samsung_smdk4412/
make clean -j4 ARCH=arm CROSS_COMPILE=arm-linux-androideabi-
make ARCH=arm CROSS_COMPILE=arm-linux-androideabi- slim_i9300_defconfig
make -j4 ARCH=arm CROSS_COMPILE=arm-linux-androideabi-
I use this guide to create the flashable zip file.
It uses koush's AnyKernel to install the new Kernel with TWRP 2.6.3.1
The updater-script looks like that so far:
ui_print("AnyKernel Updater by Koush.");
ui_print("Extracting System Files...");
set_progress(1.000000);
mount("ext4", "EMMC", "/dev/block/mmcblk0p9", "/system");
package_extract_dir("system", "/system");
unmount("/system");
ui_print("Extracting Kernel files...");
package_extract_dir("kernel", "/tmp");
ui_print("Installing kernel...");
set_perm(0, 0, 0777, "/tmp/dump_image");
set_perm(0, 0, 0777, "/tmp/mkbootimg.sh");
set_perm(0, 0, 0777, "/tmp/mkbootimg");
set_perm(0, 0, 0777, "/tmp/unpackbootimg");
run_program("/tmp/dump_image", "boot", "/tmp/boot.img");
run_program("/tmp/unpackbootimg", "/tmp/boot.img", "/tmp/");
run_program("/tmp/mkbootimg.sh");
write_raw_image("/tmp/newboot.img", "boot");
ui_print("Done!");
The 4th line was edited because of what I have found here for the i9300 .
When I flash the zip via TWRP everything seems fine but when rebooting the system the old kernel version and installation date is shown in the "About Phone" section of the Settings.
What did I miss?
Instead of using AnyKernel to flash the zImage, I created a boot.img out of the zImage using this guide and then flashed it via heimdall on my i9300:
user#ubuntu1210:~/bootimg_tools$ perl split_bootimg.pl boot.img
user#ubuntu1210:~/bootimg_tools$ perl unpack_ramdisk boot.img-ramdisk.gz ramdisk
user#ubuntu1210:~/bootimg_tools$ perl repack_ramdisk ramdisk boot.img-ramdisk.cpio.gz
user#ubuntu1210:~/bootimg_tools$ cp /home/user/kernel_samsung_smdk4412/arch/arm/boot/zImage boot.img-kernel
user#ubuntu1210:~/bootimg_tools$ ./mkbootimg --kernel boot.img-kernel --ramdisk boot.img-ramdisk.cpio.gz --cmdline 'console=null androidboot.hardware=qcom user_debug=31 zcache' --base 0x80200000 --pagesize 2048 -o boot.img
user#ubuntu1210:~/bootimg_tools$ adb reboot bootloader
user#ubuntu1210:~/bootimg_tools$ sudo heimdall flash --BOOT boot.img --verbose