[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

相关推荐
qizayaoshuap21 分钟前
鸿蒙 ArkTS 实战:搜索列表 城市实时过滤(示例 94)
android·华为·harmonyos
朝星34 分钟前
Framework筑基之Handler消息机制5(应用层)
android
硅农程序猿43 分钟前
芯片设计中的门级仿真(GLS):从零延迟验证到 SDF 时序反标
嵌入式硬件·硬件架构·risc-v·芯片
2601_965798471 小时前
ForumLab Review: Fast PHP Script for SEO Forum Sites
android·adb·php
LUCKY-LIVING1 小时前
ELF File in linux
android·java·linux
xqqxqxxq1 小时前
SQL 字段约束笔记
android·笔记·sql
深念Y2 小时前
技术探索记录 在 Android 手机上运行 One API
android·linux·服务器·智能手机·go·交叉编译·服务
圆山猫11 小时前
[Virtualization](四):Linux KVM/RISC-V 的 vCPU 运行路径
java·linux·risc-v
summerkissyou198711 小时前
Android - 摄像头 - hal - 开发教程,例子,常见问题,分析方法,解决方案
android
summerkissyou198712 小时前
Android 16 架构图
android