LineageOS for Redmi K20 Pro

Wiki

XDA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Install dependencies on arch:
`yay lineageos-devel`

Allow 300 gigabytes of disk space

// create directory
LINEAGE_BUILD_ROOT=~/android/lineage
LINEAGE_BUILD_CCACHE=~/android/ccache
mkdir -p ~/android/bin
mkdir -p $LINEAGE_BUILD_ROOT
mkdir -p $LINEAGE_BUILD_CCACHE
mkdir -p $LINEAGE_BUILD_CCACHE/tmp

// setup tools
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/android/bin/repo
chmod a+x ~/android/bin/repo
PATH="~/android/bin:$PATH"

git lfs install

// configure cache
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 50G
ccache -o compression=true
export MXE_CCACHE_DIR=$LINEAGE_BUILD_CCACHE/tmp
export CCACHE_DIR=$LINEAGE_BUILD_CCACHE

// pull source
cd $LINEAGE_BUILD_ROOT
repo init -u https://github.com/LineageOS/android.git -b lineage-20.0 --git-lfs
repo sync

mkdir -p kernel/xiaomi/sm8150
git clone git@github.com:xiaomi-sm8150-devs/android_kernel_xiaomi_sm8150-legacy.git kernel/xiaomi/sm8150

// prepare build
source build/envsetup.sh
breakfast raphael

// download vendor (need phone connected in debug mode)
cd $LINEAGE_BUILD_ROOT/device/xiaomi/raphael
./extract-files.sh
cd $LINEAGE_BUILD_ROOT

// build
croot
brunch raphael

==> ls out/target/product/raphael/ -lah

If error on pull source:
rm -rf external/chromium-webview/prebuilt/*
rm -rf .repo/projects/external/chromium-webview/prebuilt/*.git
rm -rf .repo/project-objects/LineageOS/android_external_chromium-webview_prebuilt_*.git
repo sync


update and rebuild:
repo sync
cd kernel/xiaomi/sm8150
git pull
cd $LINEAGE_BUILD_ROOT
source build/envsetup.sh
breakfast raphael
croot
brunch raphael
Author

dushicai

Posted on

2024-04-29

Updated on

2024-04-29

Licensed under