[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

相关推荐
hai3152475432 小时前
RISC-V核E203核前向旁路的架构性顽疾
驱动开发·架构·硬件架构·硬件工程·risc-v
Meteors.3 小时前
安卓源码阅读——01.grade设置binding为true时,xml如何进行映射
android·xml
_李小白4 小时前
【android opencv学习笔记】Day 26: 滤波算法之低通滤波与图像缩放插值
android·opencv·学习
NiceCloud喜云5 小时前
Claude Code Routines 实战:三种触发器跑通云端自动化编码
android·运维·数据库·人工智能·自动化·json·飞书
我命由我123458 小时前
Bugly - Bugly 基本使用( App 质量追踪平台)
android·java·java-ee·android studio·android jetpack·android-studio·android runtime
weiggle8 小时前
第二篇:搭建你的第一个 Compose 项目——开发环境与项目结构
android·前端
阿巴斯甜9 小时前
为什么 AIDL 接口客户端、服务端要写两份一模一样的?
android
时光飞逝的日子9 小时前
基于 RISC-V 架构的边缘 AI 推理引擎优化设计
risc-v·模型量化·推理引擎·边缘 ai·向量扩展·低功耗优化
weiggle9 小时前
第一篇:Jetpack Compose 宣言——为什么 Android 开发需要声明式 UI
android