[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

相关推荐
zgyhc20503 小时前
【Android Audio】dumpsys media.metrics分析
android
nono牛3 小时前
Android Binder 详解与实践指南
android·binder
小镇学者3 小时前
【PHP】PHP WebShell(网页木马)分析
android·开发语言·php
2501_916007474 小时前
iOS 压力测试的工程化体系,构建高强度、多维度、跨工具协同的真实负载测试流程
android·ios·小程序·uni-app·cocoa·压力测试·iphone
毕设源码-钟学长6 小时前
【开题答辩全过程】以 浮生馆汉服租赁管理系统为例,包含答辩的问题和答案
android·java·tomcat
louisgeek6 小时前
Android NDK 开发中的崩溃排查
android
电子科技圈7 小时前
IAR与Quintauris携手推进RISC-V汽车实时应用的功能安全软件开发
嵌入式硬件·安全·设计模式·编辑器·汽车·risc-v
2501_915921438 小时前
iOS 开发者工具推荐,构建从调试到性能优化的多维度生产力工具链(2025 深度工程向)
android·ios·性能优化·小程序·uni-app·iphone·webview
Chrison_mu9 小时前
Android项目背景动效-Kotlin
android·开发语言·kotlin
曾经的三心草10 小时前
JavaEE初阶-多线程2
android·java·java-ee