[RISCV] 为android14添加一个新的riscv device

本篇博客将基于android-14-r18添加Sifive unmatched板子的支持。

Setup build envoronment

Establishing a build environment

shell 复制代码
$ sudo apt install git-core gnupg flex bison build-essential zip curl zlib1g-dev libc6-dev-i386 libncurses5 x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig python3 python3-pip python3-setuptools python3-wheel ninja-build
$ sudo apt install libssl-dev python3-setuptools
$ sudo pip3 install meson
$ sudo pip3 install mako

Download Android source with local_manifests

Refer to Downloading the source

shell 复制代码
$ repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r18
$ git clone https://github.com/android-risc-v/local_manifests .repo/local_manifests -b arv-14
$ repo sync

Build Android for Unmatched

Refer to Building Android

shell 复制代码
$ source build/envsetup.sh
$ lunch unmatched-eng
$ make ramdisk systemimage vendorimage -j$(nproc)

Prepare sd card

Partitions of the card should be set-up like followings

p1: 128MB for /vendor ----------------->Do fdisk, new primary partition

p2: 1024MB for /system---------------->Do fdisk, new primary partition

p3: 128MB for boot---------------------->Do fdisk, set W95 FAT32(LBA) & Bootable type, sudo mkfs.vfat -n boot /dev/sdb3

p4: remainings for /data---------------->Do fdisk, sudo mkfs.ext4 -L data /dev/sdb4

Set volume label of /data partition as userdata : use -L option for mkfs.ext4

Write system & vendor partition

shell 复制代码
$ cd out/target/product/unmatched
$ sudo dd if=vendor.img of=/dev/<p1> bs=1M
$ sudo dd if=system.img of=/dev/<p2> bs=1M

Copy firmware & ramdisk to boot partition

shell 复制代码
$ cp -ra device/arv/unmatched/boot/* to p3:/
$ cp -ra out/target/product/unmatched/ramdisk.img to p3:/

Download & Build kernel

Install cross-compiler

shell 复制代码
$ sudo apt install gcc-riscv64-linux-gnu

Git clone following kernel source under separate folder apart from Android

shell 复制代码
git clone https://android.googlesource.com/kernel/common linux -b android14-6.1-lts

Build the kernel

shell 复制代码
$ ARCH=riscv scripts/kconfig/merge_config.sh arch/riscv/configs/defconfig kernel/configs/android-base.config kernel/configs/android-recommended.config
$ ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- make Image.gz sifive/hifive-unmatched-a00.dtb -j$(nproc)

Copy kernel binaries to boot partition

shell 复制代码
<kernel directory>/arch/riscv/boot/Image.gz to p3:/
<kernel directory>/arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dtb.dtb to p3:/dtbs/sifive/

Connect USB keyboard before power-up the board, at least one input device should exist.

Reference

相关推荐
冬奇Lab13 小时前
【Kotlin系列08】泛型进阶:从型变到具体化类型参数的类型安全之旅
android·开发语言·windows·安全·kotlin
摘星编程13 小时前
React Native for OpenHarmony 实战:HorizontalScroll 横向滚动详解
android·react native·react.js
行稳方能走远13 小时前
Android C++ 学习笔记5
android·c++
shughui13 小时前
Android SDK 下载、安装与配置(详细图文附安装包,适配Appium+Python自动化)
android·python·appium·android-studio·android sdk
SHEN_ZIYUAN1 天前
深度解析:从 AnimationHandler 原理看 Android 动画内存泄漏
android
冬奇Lab1 天前
稳定性性能系列之十六——车机特定场景:黑卡死问题分析与排查实战
android·性能优化
座山雕~1 天前
Springboot
android·spring boot·后端
香气袭人知骤暖1 天前
SQL慢查询常见优化步骤
android·数据库·sql
丨康有为丨1 天前
Android滑动冲突详解(场景+解决)
android
千里马学框架1 天前
疑难ANR面试题:crash导致ANR深入剖析
android·智能手机·framework·perfetto·性能·anr·小米汽车