Building custom kernel for android emulator - android

I'm trying to build an AVD image with custom kernel for android emulator, following instructions at
https://source.android.com/devices/automotive/start/avd/android_virtual_device
The problem is that the emulator only displays black screen when using self-built kernel. When I copy the kernel from prebuilts folder or use a kernel from a downloaded AVD image, it works.
I have built the avd image with following steps:
ANDROID_BRANCH="android11-qpr2-release"
REPO_URL="https://android.googlesource.com/platform/manifest"
mkdir $ANDROID_BRANCH && cd $ANDROID_BRANCH && repo init -u $REPO_URL -b $ANDROID_BRANCH --partial-clone && repo sync -c -j8
. build/envsetup.sh && lunch avd_car-userdebug && m -j8
m emu_img_zip
Then I built the kernel with following steps:
mkdir goldfish-kernel-54
cd goldfish-kernel-54
repo init -u https://android.googlesource.com/kernel/manifest -b
common-android11-5.4
repo sync
BUILD_CONFIG=common/build.config.gki.x86_64 build/build.sh
BUILD_CONFIG=common-modules/virtual-device/build.config.goldfish.x86_64
build/build.sh
ls -l ./out/android11-5.4/dist/
Then I unzipped sdk-repo-linux-system-images-eng.username.zip to system-images folder, copied bzImage to that folder and renamed bzImage to kernel-ranchu-64.

Related

How to compile and run custom kernel in Android12 for Pixel 6?

I tried to compile the Android 12 kernel, consult:https://source.android.com/setup/build/building-kernels?hl=en
mkdir android-kernel && cd android-kernel
repo init -u https://android.googlesource.com/kernel/manifest -b android-gs-raviole-5.10-android12L
repo sync
build/build.sh
I could see the logs below after I build successfully.
then:
fastboot flash boot boot.img
But I get immediately redirected back to the bootloader;
I unpack boot.img(Custom compilation) find boot.img contain ramdisk;
Do not know what causes, you have encountered? Hope to get your help

Install Git in Pydroid 3 terminal

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"

Oneplus5 Lineage OS 15.1 kernel compilation

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.

how to find size of android repository

I am following the below steps to download repo for building an android marshmellow image .
cd ~
$ mkdir myandroid
$ mkdir bin
$ cd myandroid
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ ~/bin/repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r22
$ ~/bin/repo sync
after last step it has already download 18 GB and still going on
is there anyway to find the size of this repo before downloading it.
I have searched the following link
See the size of a github repo before cloning it?
but above method gives output of message : unknown file
how to find it ?

AOSP 6.0 Build for hammerhead - proprietary binaries

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)

Categories

Resources