[Basic Tutorial 2] How to Package a Kernel using AnyKernel 3 #954
Coconutat
started this conversation in
Show and tell
Replies: 2 comments
-
@Coconutat i suggest make also tutorial on unpacking/packaging boot.img for kernel |
Beta Was this translation helpful? Give feedback.
0 replies
-
this thread is extememly well-writed |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to Package a Kernel using AnyKernel 3
As the title suggests, this is still a basic tutorial. Experienced friends can skip ahead.
1. What is AnyKernel 3?
AnyKernel3 is a flashing template for Android device kernels developed by osm0sis, a developer on the XDA forum. In fact, it is very powerful and can accommodate many custom operations.
For example:
This tutorial focuses only on the basics and does not delve into more complex content. So, don't worry; there's nothing too difficult.
The prerequisite for using AnyKernel 3 is that your device has a custom RECOVERY (e.g., TWRP, OrangeFox, or supports adb sideload). If you do not meet this condition, you can try unpacking/packaging boot.img for kernel replacement. If you have SU privileges, you can use a kernel flashing app and then use AnyKernel 3 for flashing (e.g., Kernel Flasher, Franco Kernel Manager, EX Kernel Manager).
2. Using AnyKernel 3
On your computer, use the following command to clone this project:
Then, navigate to the root directory of AnyKernel 3.
Next, let's understand the basic directory structure of AnyKernel 3:
As a beginner, you don't need to worry about the other files for now; just focus on anykernel.sh and LICENSE.
Open anykernel.sh with your favorite text editor. You'll see a lot of content, but let me simplify it for you. Here's the streamlined version:
Here's what you need to know from this script:
kernel.string=
: This is where you should enter the name of your kernel. You can write anything you like.do.devicecheck=
: Enter 1 to enable device checking or 0 to disable it. This is used to check the device name, which corresponds todevice.name1
todevice.name5
below. If the device name doesn't match, the kernel won't flash.device.name1
todevice.name5
: Here, you can enter your device's name. Note that some phones have development codenames, while others have specific device names. Use these parameters withdo.devicecheck
enabled.block= XXXX
: This should specify the partition where the kernel should be flashed, typically "boot."is_slot_device=
: Enter 1 to enable, 0 to disable, or "auto" for automatic detection. Use this for devices with AB slots (Virtual A/B or A/B partitioning).patch_vbmeta_flag=
: Enter 1 to enable, 0 to disable, or "auto" for automatic detection. This determines whether to patch vbmeta to disable AVB verification. This depends on your device, so you need to make the determination yourself.With this information, you can modify the provided template script to create your own kernel flash package. Here's a generic script you can use:
Note that this script is just a template. You still need to modify and verify its contents based on the instructions above!
3. Packaging Your Kernel
Copy your kernel into the root directory of AnyKernel 3. Assuming your kernel's name is Image.gz, your AnyKernel 3 root directory should look like this:
Then, compress all the contents in the root directory into a zip file. Please remember to use zip, not rar, 7z, tar, or any other format!!!
Now, you can flash and test your kernel using TWRP.
Regarding the LICENSE:
The LICENSE file is a license agreement, which means AnyKernel 3 is legally protected, and you must comply with the terms of the license. Please strictly adhere to the restrictions outlined in the LICENSE.
4. Conclusion
This is just a basic tutorial on using AnyKernel 3. If you have any better ideas or suggestions, please feel free to share them in the comments.
5. Thanks
@osm0sis
Beta Was this translation helpful? Give feedback.
All reactions