正文
进入 ~/bin 目录中
cd ~/bin
curl 8c3K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6K6N6r3!0J5j5h3N6W2i4K6u0W2k6$3!0G2k6$3I4W2j5i4m8A6M7#2)9J5k6h3y4G2L8g2)9J5c8X3N6A6N6q4)9J5k6s2u0W2M7r3!0Q4x3X3c8V1L8%4N6F1L8r3!0S2k6s2y4Q4x3V1k6J5k6i4m8G2i4K6t1$3L8X3u0K6M7q4)9K6b7W2)9J5y4X3N6@1i4K6y4n7i4K6t1$3L8X3u0K6M7q4)9K6b7W2)9%4c8g2)9J5c8X3u0A6L8W2)9J5c8Y4u0W2M7r3)9`.
chmod a+x ~/bin/repo
然后将repo目录添加到环境变量中
将下面的内容添加到上面的文件中的最下面,注意要对应自己的repo所在的目录中
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
然后运行 source ~/.profile 刷新环境变量
配置git
随便填
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
开启缓存
开启缓存加快同步代码的速度,如果你的硬盘足够大,超过500G,ccache指定的大小可以是100G,如果没有就指定50G。
export USE_CCACHE=1
export CCACHE_EXEC=/usr/bin/ccache
ccache -M 100G
ccache -o compression=true
初始化lineageos源存库
cd ~/android/lineage
repo init -u 164K9s2c8@1M7s2y4Q4x3@1q4Q4x3V1k6Q4x3V1k6Y4K9i4c8Z5N6h3u0Q4x3X3g2U0L8$3#2Q4x3V1k6x3K9h3&6W2j5h3N6W2e0#2y4Q4x3V1k6S2L8X3c8J5L8$3W2V1i4K6u0W2k6$3W2@1i4K6t1$3L8X3u0K6M7q4)9K6b7W2)9J5k6r3u0Q4x3U0k6F1j5Y4y4H3i4K6y4n7L8r3W2F1k6h3q4Y4k6g2)9J5k6o6p5^5i4K6u0W2x3g2)9J5y4X3&6T1M7%4m8Q4x3@1u0Q4x3X3c8Q4x3X3c8Y4K9i4c8Q4x3X3c8D9k6Y4y4Q4x3U0k6F1j5Y4y4H3i4K6y4n7i4K6u0V1i4K6u0V1L8X3!0Q4x3X3c8U0L8r3!0F1k6g2)9J5k6r3u0#2L8X3c8D9k6b7`.`.
执行下面的命令是下载源码,你可以根据当前ubuntu的CPU核心数量去指定线程数量,一般是核心数量的2倍。作者的核心数量是10,所以指定20线程。注意,同步过程中有报错是正常的,因为官方会限制短期的请求数量,不用管继续等就好了。
这条命令执行完毕之后,记得再执行 repo status 查看当前的同步状态,如果出现nothing to commit这种字眼说明同步完成了,可以不用看下面的注意了。同步完成之后,就是源代码拉去完毕了,可以进行下一个步骤了。
注意, 没有出现上面提到的字眼就是失败了,失败的话建议执行 repo sync 命令去补全,注意最好不要指定多线程。
准备特定于设备的代码
进入到安卓源码项目的根目录,然后运行下面的命令用来下载设备的特定配置和内核。这里的flame是我的设备代号,其他的设备代号需要自己查然后把flame替换成自己的设备代号。
cd ~/android/lineage
source build/envsetup.sh
breakfast flame
第一次运行breakfast 命令,会出现下面的错误,我觉得这里是最大的坑
kerneldev@ubuntu:~/android/lineage$ breakfast flame
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
device/google/coral/device-lineage.mk:113: error: _nic.PRODUCTS.[[device/google/coral/lineage_flame.mk]]: "vendor/google/flame/flame-vendor.mk" does not exist.
19:31:40 dumpvars failed with: exit status 1
Device flame not found. Attempting to retrieve device repository from LineageOS Github (72cK9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8X3N6A6N6r3S2#2j5W2)9J5k6h3y4G2L8g2)9J5c8V1I4A6L8X3g2S2k6$3g2a6f1#2)9J5z5g2)9J5k6b7`.`.
Found repository: android_device_google_flame
Default revision: lineage-18.1
Checking branch info
Checking if device/google/flame is fetched from android_device_google_flame
LineageOS/android_device_google_flame already fetched to device/google/flame
Syncing repository to retrieve project.
Fetching: 100% (1/1), done in 0.511s
Checking out: 100% (1/1), done in 0.001s
repo sync has finished successfully.
Repository synced!
Looking for dependencies in device/google/flame
Looking for dependencies in device/google/coral
Looking for dependencies in kernel/google/coral
kernel/google/coral has no additional dependencies.
Looking for dependencies in packages/apps/ElmyraService
packages/apps/ElmyraService has no additional dependencies.
Done
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
device/google/coral/device-lineage.mk:113: error: _nic.PRODUCTS.[[device/google/coral/lineage_flame.mk]]: "vendor/google/flame/flame-vendor.mk" does not exist.
19:31:43 dumpvars failed with: exit status 1
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
device/google/coral/device-lineage.mk:113: error: _nic.PRODUCTS.[[device/google/coral/lineage_flame.mk]]: "vendor/google/flame/flame-vendor.mk" does not exist.