Android车机DIY开发之学习篇(六)编译讯为3568开发板安卓
Android车机DIY开发之学习篇(六)编译讯为3568开发板安卓
1.SDK解压到家目录下的 rk3588_android_sdk 目录
一. 全部编译
###安装所需环境
sudo apt-get update
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib
g+±multilib libc6-dev-i386 lib32ncurses5-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev
libxml2-utils xsltproc unzip python-pyelftools python3-pyelftools device-tree-compiler libfdt-dev
libfdt1 libssl-dev liblz4-tool python-dev libncurses5 make
执行以下命令
sudo rm -rf /usr/bin/python
sudo ln -s /usr/bin/python2 /usr/bin/python
git config --global user.name “zc9527”
git config --global user.email"1508890767@qq.com"
cd ~/rk3588_android_sdk/
.repo/repo/repo sync -l -j16
source build/envsetup.sh
lunch rk3568_r-userdebug
./build.sh -UKA -J10
二. 编译u-boot
在根目录下执行
source build/envsetup.sh
make clean
lunch rk3568_r-userdebug
. /build.sh -U
U-boot 中添加自己的开发板
1.u-boot/configs 目录下创建默认配置文件, 复制 rk3568_defconfig, 然后重新命名为 AAOS_defconfig
2.修改uboot下编译脚本 make.sh
echo " ./make.sh evb-rk3399 --- build for evb-rk3399_defconfig"
echo " ./make.sh firefly-rk3288 --- build for firefly-rk3288_defconfig"
**echo " ./make.sh AAOS --- build for AAOS_defconfig"**
echo " ./make.sh EXT_DTB=rk-kernel.dtb --- build with exist .config and external dtb"
echo " ./make.sh --- build with exist .config"
echo " ./make.sh env --- build envtools"
3. 修改 device/rockchip/rk356x/BoardConfig.mk 文件, 修改
PRODUCT_UBOOT_CONFIG 的值为 AAOS_defconfig
4.在 u-boot/arch/arm/dts/目录下创建默认配置文件, 复制 rk3568-evb.dts , 然
后重新命名为AAOS-evb.dts
5.修改 u-boot/configs AAOS_defconfig 文件, 设置默认的设备树为
AAOS-evb.dts
CONFIG_DEFAULT_DEVICE_TREE="AAOS-evb"
6. 打开u-boot/arch/arm/dts/AAOS-evb.dts 设备树
model = “AAOS Evaluation Board”;
三. 编译Kernel
方法一:在根目录下执行
source build/envsetup.sh
make clean
lunch rk3568_r-userdebug
./build.sh -CKA
### 方法二:在kernel目录下执行
cd kernel
make ARCH=arm64 CC=…/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang
LD=…/prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld rockchip_defconfig
android-11.config && make ARCH=arm64
CC=…/prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang
LD=…/prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld
BOOT_IMG=…/rockdev/Image-rk3568_r/boot.img rk3568-evb1-ddr4-v10.img
内核本地化
1.拷贝参考模板
进入/device/rockchip/rk3588 目录, 将/device/rockchip/rk3588/rk3588_s 作
为 模 板 ( 如 果 是 Android13 , 选 择 rk3588_t 作 为 模 板 ) , 将 其 拷 贝 到
/device/rockchip/rk3588/AAOS_rk3588
2.修改 device/rockchip/rk3588/AndroidProducts.mk 文件
PRODUCT_MAKEFILES :=
$(LOCAL_DIR)/my_rk3588/AAOS_rk3588.mk
$(LOCAL_DIR)/rk3588_s/rk3588_s.mk
$(LOCAL_DIR)/ATK_DLRK3588/ATK_DLRK3588.mk
$(LOCAL_DIR)/rk3588s_s/rk3588s_s.mk
$(LOCAL_DIR)/rk3588_box/rk3588_box.mk
$(LOCAL_DIR)/rk3588_xr/rk3588_xr.mk
$(LOCAL_DIR)/rk3588m_s/rk3588m_s.mk
$(LOCAL_DIR)/rk3588m_car/rk3588m_car.mk \
COMMON_LUNCH_CHOICES :=
AAOS_rk3588-userdebug
AAOS_rk3588-user
ATK_DLRK3588-userdebug
ATK_DLRK3588-user
rk3588_s-userdebug
rk3588_s-user
rk3588s_s-userdebug
rk3588s_s-user
rk3588_box-userdebug
rk3588_box-user
rk3588_xr-userdebug
rk3588_xr-user
rk3588m_s-userdebug
rk3588m_s-user
rk3588m_car-userdebug \
3.修改 my_rk3588.mk
进入到 device/rockchip/rk3588/my_rk3588 目录, 将该目录下的 rk3588_s.mk 文件重命
名为 my_rk3588.mk,修改内容
PRODUCT_NAME := AAOS_rk3588
PRODUCT_DEVICE := AAOS_rk3588
PRODUCT_BRAND := rockchip
PRODUCT_MODEL := AAOS_rk3588
PRODUCT_MANUFACTURER := rockchip
PRODUCT_AAPT_PREF_CONFIG := xhdpi
4.修改路径信息
修改 AAOS_rk3588.mk
include device/rockchip/common/build/rockchip/DynamicPartitions.mk
include device/rockchip/rk3588/AAOS_rk3588/BoardConfig.mk
include device/rockchip/common/BoardConfig.mk
修改BoardConfig.mk 文件
ifeq ($(strip $(BOARD_USES_AB_IMAGE)), true)
include device/rockchip/common/BoardConfig_AB.mk
TARGET_RECOVERY_FSTAB := device/rockchip/rk3588/AAOS_rk3588/recovery.fstab_AB
endif