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

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

Setup build envoronment

Establishing a build environment

$ 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

$ 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

$ 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

$ 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

$ cp -ra device/arv/unmatched/boot/* to p3:/
$ cp -ra out/target/product/unmatched/ramdisk.img to p3:/

Download & Build kernel

Install cross-compiler

$ sudo apt install gcc-riscv64-linux-gnu

Git clone following kernel source under separate folder apart from Android

git clone https://android.googlesource.com/kernel/common linux -b android14-6.1-lts

Build the kernel

$ 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

<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

Makefile工程文件移植到MounRiver Studio 报错 13:10:47 **** 构建 of configuration obj for project CH32V307VCT6 **** make -j12 all In file included from ../programmer/cdc.c:6: C:\Users\biaog\Desktop\CH32V307VCT6\vendor\Peripheral\inc/ch32v30x.h:183:10: fatal error: core_riscv.h: No such file or directory #include "core_riscv.h" ^~~~~~~~~~~~~~ compilation terminated. make: *** [programmer/subdir.mk:65: programmer/cdc.o] Error 1 make: *** Waiting for unfinished jobs.... In file included from ../programmer/clock.c:7: C:\Users\biaog\Desktop\CH32V307VCT6\vendor\Peripheral\inc/ch32v30x.h:183:10: fatal error: core_riscv.h: No such file or directory #include "core_riscv.h" ^~~~~~~~~~~~~~ compilation terminated. make: *** [programmer/subdir.mk:65: programmer/clock.o] Error 1 In file included from ../programmer/flash.c:6: C:\Users\biaog\Desktop\CH32V307VCT6\vendor\Peripheral\inc/ch32v30x.h:183:10: fatal error: core_riscv.h: No such file or directory #include "core_riscv.h" ^~~~~~~~~~~~~~ compilation terminated. make: *** [programmer/subdir.mk:65: programmer/flash.o] Error 1 In file included from ../programmer/fsmc_nand.c:8: C:\Users\biaog\Desktop\CH32V307VCT6\vendor\Peripheral\inc/ch32v30x.h:183:10: fatal error: core_riscv.h: No such file or directory #include "core_riscv.h" ^~~~~~~~~~~~~~ compilation terminated. make: *** [programmer/subdir.mk:65: programmer/fsmc_nand.o] Error 1 In file included from ../programmer/jtag.c:6: C:\Users\biaog\Desktop\CH32V307VCT6\vendor\Peripheral\inc/ch32v30x.h:183:10: fatal error: core_riscv.h: No such file or directory #include "core_riscv.h" ^~~~~~~~~~~~~~ compilation terminated. make: *** [programmer/subdir.mk:65: programmer/jtag.o] Error 1 13:10:52 Build Failed. 11 errors, 0 warnings. (took 5s.146ms)
最新发布
07-10
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山猫Show

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值