• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Making my first kernel for the A20

Search This thread

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
Building a First Kernel for the Galaxy A20
by physwizz

At last, I've been able to build a very basic kernel.
This is a first attempt.
It's not overclocked so don't expect anything miraculous.

Thanks to @Chatur27for building help and @Topser99 for the flashable zip

THIS IS WHAT I DID

Requirements


Use Linux 64bit ( I used Linux Mint Mate in a Virtual Box)

Linux setup

$ sudo apt update
$ sudo apt upgrade
$ sudo apt-get install git-all
$ git config --global user.name "physwizz"
$ git config --global user.email "[email protected]"

Kernel setup

1. Download the compiler


Unzip into "Compiler" folder

2. Download the Source Code (https://opensource.samsung.com/main)
Search for A205 and select QQ version (Latin)
Extract the kernel.tar.7z
extract into "Kernel" folder


Beginners guide to github

I have always had a lot of difficulty with github.

I have jotted down a few things which might help some new kernel builders.

A. Github Setup

1. Go to github and Open a new Repo
I called mine "physwizz_kernel"

2. To set up SSH key

$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Github Name"

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

Press enter 3 times

$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa
$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub

3. The SSH key will be in clipboard
Go to github settings => SSH and GPG keys
Paste key here

B. Using github

1. Open Terminal In The Kernel Folder

$ git init
$ git remote add origin (github id) mine is [email protected]: physwizz/physwizz_kernel.git
$ touch README
$ git add README
$ git add --all
$ git commit -m "Initial commit"
$ git push -u origin main

2. To cherry pick a commit from another github repository

firstly add the other repository to your kernel
$ git remote add other https:<other address>
$ git fetch --all
$ git cherry-pick [hash_id]

3. to push changes to github

$ make clean && make mrproper
$ git add --all

if the change is your own
$ sudo git commit -a

write comment
ctrl o (to output)
enter
ctrl x (to exit)

then
$ git push origin main

if the change is a cherry pick
$ git commit "change made" --author="Author's name<author's email>"

then
$ git push origin main

4. If it doesn't work or if you want to try something else

$ git revert <commit hash code>
$ git push origin main

Or
$ git reset --hard < last clean commit hash >
$ git push origin main -f
$ git cherry pick <clean commits >
$ git push origin main


5. to edit last commit

$ git commit --amend -e
$ git push origin main

Please give any feedback.
@physwizz


Kernel Building

1. open the defconfig file with text editor

Mine was located at
/home/physwizz/Kernel/arch/arm64/configs/exynos7885-a20_defconfig
You can make a copy of this file and call it original_defconfig

CHANGES I MADE

physwizz_kernel_V1


CONFIG_LOCALVERSION="physwizz"

# CONFIG_CC_STACKPROTECTOR_STRONG is not set

Later versions in post #2

2. open terminal
cd Kernel

make clean && make mrproper
export CROSS_COMPILE=/home/physwizz/compiler/bin/aarch64-linux-android-
export ARCH=arm64
export ANDROID_MAJOR_VERSION=q
make exynos7885-a20_defconfig
make

3. Output is found in /home/physwizz/Kernel/arch/arm64/boot


4. Copy Image from boot folder and Insert it into the MyKernel.zip

5. Extract Version and edit it then reinsert


To use Anykernel to make your own zip

Extract MyKernel.7z to a folder, copy kernel image there, open terminal in that folder and type:

zip -r9 UPDATE-AnyKernel3.zip * -x .git README.md *placeholder

TheUPDATE-AnyKernel3.zip will be in the folder.
Cut and paste it outside the folder then flash it from TWRP.
Make sure you don't leave the UPDATE-AnyKernel3.zip in the MyKernel folder because it will interfere with the next zip you make.

Need to flash Magisk 20.4 or Magisk 21

Works with stock dtbo or Eureka dbto
If you flash Eureka dbto you will get overclocking of the GPU.

Overclocking
Version 1.4 is when I started overclocking
See post 2

Compiler (you can clone this)
https://github.com/physwizz/compiler

Source
https://github.com/physwizz/physwizz_kernel


NEWER VERSIONS IN POST#2

 

Attachments

  • flash_dtbo_stock.zip
    253.8 KB · Views: 28
  • physwizz_kernel_v1.zip
    12.7 MB · Views: 39
  • flash_dtbo_for_Eureka.zip
    544.8 KB · Views: 36
  • MyKernel.7z
    1.9 MB · Views: 43
  • MyKernel.zip
    2.6 MB · Views: 45
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
New Versions

Version 1.1 has one Samsung security disabled
# CONFIG_SECURITY_DEFEX is not set

Version 1.25
Version 1.25 has all 6 CPU governors enabled

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_INTERACTIVE=y

CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y

Version 1.3
Userspace is the default governor
More securities disabled
Selinux enforcing

# CONFIG_TIMA is not set
# CONFIG_TIMA_LKMAUTH is not set
# CONFIG_TIMA_LKM_BLOCK is not set
# CONFIG_TIMA_LKMAUTH_CODE_PROT is not set
# CONFIG_UH is not set
# CONFIG_UH_RKP is not set
# CONFIG_RKP_KDP is not set
# CONFIG_RKP_NS_PROT is not set
# CONFIG_RKP_DMAP_PROT is not set

# CONFIG_TIMA_LOG is not set
# CONFIG_KNOX_KAP is not set

# CONFIG_DM_VERITY is not set

# CONFIG_SEC_RESTRICT_ROOTING is not set
# CONFIG_SEC_RESTRICT_SETUID is not set
# CONFIG_SEC_RESTRICT_FORK is not set
# CONFIG_SEC_RESTRICT_ROOTING_LOG is not set

# CONFIG_INTEGRITY is not set
# CONFIG_INTEGRITY_SIGNATURE is not set
# CONFIG_INTEGRITY_ASYMMETRIC_KEYS is not set
# CONFIG_INTEGRITY_AUDIT is not set

# CONFIG_SECURITY_DSMS is not set
# CONFIG_PROCA is not set


Version 1.4
Overclocked
Big 2080 Little 169
https://github.com/physwizz/physwizz_kernel/commit/06df375cfe6d9897a846eee8bcf9b05a48ae9cb7

v1.45
CPU underclocking
https://github.com/physwizz/physwizz_kernel/commit/261a80eb4ac14dc01c82af204d90420e220f386f

https://github.com/physwizz/physwizz_kernel/commit/6ff437e452d14d2bff2fd01bebd4af2e26f713d0

v1.46
Interactive set as default governor
Running very smoothly

V1.47

GPU overclocked
https://github.com/physwizz/physwizz_kernel/commit/839b38e9ec5f029a6764f057b78e5a0132dc281c
This didn't work

V1.49
Overclocking big CPU to 2184
https://github.com/physwizz/physwizz_kernel/commit/19ebb155873bfa2cf26cc685c8a746927d221064

V1.51
CPU minimum both 208MHz

V1.52
Cpu boost
Mali bts optimisation
Page boot
Muic support vbus boost
 

Attachments

  • physwizz_kernel_v1.1.zip
    12.4 MB · Views: 6
  • physwizz_kernel_v1.25.zip
    12.7 MB · Views: 6
  • physwizz_kernel_v1.3.zip
    12.4 MB · Views: 2
  • physwizz_kernel_v1.4.zip
    13.3 MB · Views: 9
  • physwizz_kernel_v1.45.zip
    13.3 MB · Views: 6
  • physwizz_kernel_v1.46.zip
    13.3 MB · Views: 5
  • physwizz_kernel_v1.47.zip
    13.3 MB · Views: 4
  • physwizz_kernel_v1.49_a20.zip
    13.3 MB · Views: 2
  • physwizz_kernel_v1.51_a20(OneUI).zip
    13 MB · Views: 4
  • physwizz_kernel_v1.52_a20(OneUI).zip
    13 MB · Views: 27
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
physwizz v2.19 A20
@physwizz

-Most securities disabled
-CPU Governors: conservative, ondemand, userspace, powersave, interactive, performance.
-Interactive is default governor
-SE linux enforcing
-CPU overclocked and underclocked
-Big: 208 - 2184
-Little: 208 - 1690
-GPU: 343 - 1300
-Works with Magisk 21
-Spectrum support enabled
-1.33mb dtbo.img (Thanks to geckyn & Chatur for dtbo config method)


Resources for further development

Resources from Carlos


· Overclock to CPU (https://github.com/carlos-burelo/Qu...mmit/9bb4d77e2f53ce7f4ada191c119d1127f9eee335)

· Permisive Mode (https://github.com/carlos-burelo/Qu...mmit/1a5a4a1bdd38115a0f7590b8f339fae856583a92)

· Enable Governors (https://github.com/carlos-burelo/Qu...mmit/1bfa400ca5c26746d99531180367d7195c4570b8)

Resources From Chatur

https://github.com/Chatur27/Eureka-...mmit/54a8b7104eb91b6847cb266ae3983aead1773855


https://github.com/Chatur27/Eureka-...mmit/d8591fc630ee75919dab405948190b92a80b17f9

https://github.com/Chatur27/Eureka-...mmit/b86b8733b4fd37790ba7921b9241b2bbbfdb6da9


https://github.com/Chatur27/Eureka-...mmit/305ec130c8a2a101c7166af9ed178d4ac4925596

https://github.com/Chatur27/Eureka-...mmit/295619ff9a097aa4ba2ee6109a23c0b440ec60fe
 

Attachments

  • physwizz_kernel_v2.19(a20-OneUI).zip
    13.3 MB · Views: 13
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
Version 1.25 has all 6 CPU governors enabled


CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_INTERACTIVE=y

CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
 
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
Works with stock dtbo or Eureka dbto
If you flash Eureka dbto you will get some overclocking.

Frequency ranges
Stock dtbo
Big 936 - 1560
Little 449 - 1352
GPU 343 - 676

Eureka dtbo
Big 312 - 1560
Little 208 - 1352
GPU 343 - 1300
 

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
physwizz v1.45

Most securities disabled
All CPU Governors enabled
Userspace is default governor
SE linux enforcing
CPU overclocked and underclocked
Big: 312 - 2080
Little: 208 - 1690
Works with Magisk 21
Works with stock dbto
 
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
To use Anykernel to make your own zip

Extract MyKernel.7z to a folder, copy kernel image there, open terminal in that folder and type:

zip -r9 UPDATE-AnyKernel3.zip * -x .git README.md *placeholder

The zip will be in the folder.
Cut and paste it outside the folder then flash it from TWRP.

https://mega.nz/file/8sMA3Bpa#2iyTwsp1rmHdhy84tInEDpnmBIOc8ydkimeSfQSq2ZA
 

Attachments

  • MyKernel.7z
    1.9 MB · Views: 3
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
physwizz v1.47 A20

Most securities disabled
All CPU Governors enabled
Interactive is default governor
SE linux enforcing
CPU overclocked and underclocked
Big: 312 - 2080
Little: 208 - 1690
Works with Magisk 21
Works with stock dbto
GPU overclocked 343 - 1300
 

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
V1.51
CPU minimum both 208MHz

V1.52
Cpu boost
Mali bts optimisation
Page boot
Muic support vbus boost
 

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
to push changes to github

if the change is your own
$ sudo git commit -a

if the change is a cherry pick
$ sudo git commit "change made" --author="Author's name<author's email>"

then
$ git push origin main

If it doesn't work or if you want to try something else
$ git revert<commit hash code>
 

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
physwizz v2.19 A20
@physwizz

-Most securities disabled
-CPU Governors: conservative, ondemand, userspace, powersave, interactive, performance.
-Interactive is default governor
-SE linux enforcing
-CPU overclocked and underclocked
-Big: 208 - 2184
-Little: 208 - 1690
-GPU: 343 - 1300
-Works with Magisk 21
-Spectrum support enabled
-1.33mb dtbo.img (Thanks to geckyn & Chatur for dtbo config method)
 

Attachments

  • physwizz_kernel_v2.19(a20-OneUI).zip
    13.3 MB · Views: 14

physwizz

Senior Member
Sep 16, 2013
3,164
687
Sydney
I have always had a lot of difficulty with github.

I have jotted down a few things which might help some new kernel builders.

B. Using github

1. Open Terminal In The Kernel Folder

$ git init
$ git remote add origin (github id) mine is [email protected]: physwizz/physwizz_kernel.git
$ touch README
$ git add README
$ git add --all
$ git commit -m "Initial commit"
$ git push -u origin main --force

To cherry pick a commit from another github repository

firstly add the other repository to your kernel
$ git remote add other https:<other address>
$ git cherry-pick [hash_id]

to push changes to github

$ make clean && make mrproper
$ git add --all

if the change is your own
$ git commit -a

write comment
ctrl o (to output)
enter
ctrl x (to exit)

then
$ git push origin main


if the change is a cherry pick
$ git commit "change made" --author="Author's name<author's email>"

then
$ git push origin main

If it doesn't work or if you want to try something else
$ git revert <commit hash code>
$ git push origin main

to edit last commit

$ git commit --amend
$ git push origin main
 
Last edited:

Top Liked Posts