WSL 2上のUbuntuでAndroid (LineageOS)をビルドしたい
やりましょう!
参考にした
このページの通りにセットアップする
$ wsl --set-default-version 2
ユーザー名とパスワード入力してセットアップ完了
https://gyazo.com/8d248ff8fcb929ef2eb19bdf875f9d22
$ sudo apt update
$ sudo apt full-upgrade
$ sudo apt install build-essential ccache libncurses5 libssl-dev m4 unzip zip
home/username に居る前提で話を進める
repoを入れる
$ mkdir ~/bin
$ PATH=~/bin:$PATH
repo を実行してもpythonがないと怒られたのでシンボリックリンクを作る。
$ sudo ln -s /usr/bin/python3 /usr/bin/python
repoのinit
$ mkdir -p android/lineage
$ cd android/lineage/
$ repo init -u git://github.com/LineageOS/android.git -b lineage-18.1
(怒られちゃった……)
https://gyazo.com/ab1bcc70648abbf40e3cdc8d692f9682
ちゃんと設定する
$ repo sync
トイレに行く
音ゲーをする
コーラを飲む
https://gyazo.com/9735afc6e6c3c15ae03b597fe24d2c5b
うおおお
$ repo sync
念のためもう一度
デバイス固有のコードを取得する
$ source build/envsetup.sh
$ breakfast oneplus3
(怒られちゃった……)
https://gyazo.com/16a8a3b9fd8b77cf538eee02e9f94514
ここから進めない
続行だ続行
https://gyazo.com/b8614bb5e18556cf8b71ad7b92700ff3
???
lineage-17.1ブランチにはextract_utils.shがあるけど、lineage-18.1にはない
なんで?
18.1を諦めて17.1をビルドする
$ rm -rf ./*
さよなら……
$ repo init -u git://github.com/LineageOS/android.git -b lineage-17.1
$ repo sync --force-sync -j8
$ breakfast oneplus3
もちろん怒られる
$ mkdir ~/android/system_dump/
LineageOSのzipからバイナリブロブを引っこ抜く
$ cd ~/android/system_dump/
$ cd ./device/oneplus/oneplus3/
$ sudo apt install patchelf
$ ./extract-files.sh ~/android/system_dump/
$ unzip ~/lineage-17.1-20210118-nightly-oneplus3-signed.zip system.transfer.list system.new.dat*
$ brotli --decompress --output=system.new.dat system.new.dat.br
$ python sdat2img/sdat2img.py system.transfer.list system.new.dat system.img
$ mkdir system/
$ sudo mount system.img system/
/device/oneplus/oneplus3/ に移動
$ ./extract-files.sh ~/android/system_dump/
https://gyazo.com/080ce301aa3e070e759e9da634f2f482
よさそう
$ source build/envsetup.sh
$ breakfast oneplus3
https://gyazo.com/b2dd494e5984ca8f7387b6fb541313e0
$ export LC_ALL=C
$ croot
$ brunch oneplus3
https://gyazo.com/f4a43d191998a0a2d68cb2458c8d0dfa
できたー
https://gyazo.com/7b29da8b5fdfc5480d22bc8541d50901
ヨシ!
大体2時間くらい