一、源码获取
1.1 源码获取
链接:百度网盘 请输入提取码
提取码:1234
$ mkdir purple-pi
#将下载的ido_purple_pi_oh_ohos3.2_sdk.tgz拷贝到purple-pi
$ cd purple-pi
$ md5sum ido_purple_pi_oh_ohos3.2_sdk.tgz
e6ca2d96aa7c628992ae0bbf4d14c2ca ido_purple_pi_oh_ohos3.2_sdk.tgz
#查看其md5sum与百度网盘里面的md5值是否一致,如果不一致请重新下载
$ tar xzvf ido_purple_pi_oh_ohos3.2_sdk.tgz -C .
$ git reset --hard
不允许 [attr]noeol -text:third_party/python/.gitattributes:25
不允许 [attr]dos text eol=crlf:third_party/python/.gitattributes:36
不允许 [attr]generated linguist-generated=true diff=generated:third_party/python/.gitattributes:63
正在更新文件: 100% (701090/701090), 完成.
HEAD 现在位于 355831a8b1 industio first commit
1.2 补丁更新及获取链接
链接:百度网盘 请输入提取码
提取码:1234
#将下载的补丁放到源码根目录下,并执行以下命令
$ git am 0001-add-codec-and-libomx.patch
Applying: add codec and libomx
.git/rebase-apply/patch:30: trailing whitespace.
.git/rebase-apply/patch:52: trailing whitespace.
warning: 2 lines add whitespace errors.
验证是否打上补丁
#执行git log命令,出现以下信息即成功打上补丁
$ git log
commit a4dbfd187a99fdb0813bc9ed065ea597c3c40da6 (HEAD -> master)
Author: lyle <120637011@qq.com>
Date: Fri Jun 30 13:42:26 2023 +0800
add codec and libomx
二、环境搭建
建议使用Ubuntu20.04 LTS搭建开发环境,硬盘至少120GB,DDR至少4GB
2.1 安装工具包安装
sudo apt-get install aptitude
$ sudo aptitude install -y binutils binutils-dev git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib gcc-arm-linux-gnueabi x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby genext2fs device-tree-compiler make libffi-dev e2fsprogs pkg-config perl openssl libssl-dev libelf-dev libdwarf-dev u-boot-tools mtd-utils cpio doxygen liblz4-tool openjdk-8-jre gcc g++ texinfo dosfstools mtools default-jre default-jdk libncurses5 apt-utils wget scons tar rsync git-core libxml2-dev lib32z-dev grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools git-lfs
$ sudo apt-get install -y pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5-dev libncursesw5 libstdc++6 vim ssh locales gcc-arm-linux-gnueabi
2.2 VirtualBox工程导入说明
这是基于Oracle VM VirtualBox 7.0;Ubuntu20登录
工程名称 | ubuntu20_purple_pi_industio.ova |
用户\密码 | industio\1234 |
工程代码路径 | /home/industio/share/rk3566/ido_purple_pi_oh_ohos3.2 |
三、SDK编译
3.1完整编译
$./build.sh --product-name purple_pi_oh --ccache
编译成功有如下日志:
[O[OHOS INFO]
[OHOS INFO] purple_pi_oh build success
[OHOS INFO] cost time: 0:41:56
=====build successful=====
失败时log所以位置:./out/purple_pi_oh/build.log
编译成功后生成的固件所以位置:./out/purple_pi_oh/packages/phone/images/
编译成功后的固件为arm64系统,屏幕为MIPI屏,改为HDMI显示可以使用如下单独编译内核的方法:./mkboot.sh HDMI
编译为arm32位系统,使用如下命令:
$./build.sh --product-name purple_pi_oh --ccache --target-cpu arm
3.2单独编译内核
$rm ./out/kernel -rf
$./build.sh --product-name purple_pi_oh --build-target kernel --ccache
//MIPI屏:
$./mkboot.sh MIPI
//HDMI屏:
$./mkboot.sh HDMI
编译成功后生成的文件位置:./out/purple_pi_oh/packages/phone/images/resource.img 和boot_linux.img
注:单独编译内核需要在完整编译过的基础上。
3.3单独编译模块
$./build.sh --product-name purple_pi_oh --build-target xxx
例:./build.sh --product-name purple_pi_oh --build-target=audio_sample_capture
生成文件:./out/purple_pi_oh/hdf/drivers_peripheral_audio/audio_sample_capture
四、固件烧录
烧录参考:Purple-Pi-OH 固件烧录手册