ubuntu20.04 开源鸿蒙源码编译配置

替换华为源

bash 复制代码
sudo sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list && sudo sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list 

安装依赖工具

如果是ubuntu20.04系统请直接安装python3.9,如果是ubuntu18.04请改为安装python3.8

bash 复制代码
sudo apt-get update && sudo apt-get install -y apt-utils binutils bison flex bc build-essential make mtd-utils gcc-arm-linux-gnueabi u-boot-tools python3.9 python3-pip git zip unzip curl wget gcc g++ ruby dosfstools mtools default-jre default-jdk scons python3-distutils perl openssl libssl-dev cpio git-lfs m4 ccache zlib1g-dev tar rsync liblz4-tool genext2fs binutils-dev device-tree-compiler e2fsprogs git-core gnupg gnutls-bin gperf lib32ncurses5-dev libffi-dev zlib* libelf-dev libx11-dev libgl1-mesa-dev lib32z1-dev xsltproc x11proto-core-dev libc6-dev-i386 libxml2-dev lib32z-dev libdwarf-dev rsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools  pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5 libncurses5-dev libncursesw5 libstdc++6  locales doxygen libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev

建立python软连接

bash 复制代码
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1

配置SSH公钥

bash 复制代码
#生成本地ssh秘钥
ssh-keygen
bash 复制代码
cat ~/.ssh/id_rsa.pub

将cat的所有内容拷贝添加到gitee等开源鸿蒙的代码托管网站

配置git信息

bash 复制代码
#配置用户名和邮箱
git config --global user.name "yourname"(用户名)
git config --global user.email "your email address"(邮箱)
#设置全局帐号密码
git config --global credential.helper store

配置repo

在root用户下

bash 复制代码
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo
bash 复制代码
#设置权限
chmod a+x /usr/local/bin/repo
bash 复制代码
#安装码云repo工具
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests

拉取代码

bash 复制代码
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c  # 以后每天同步远程仓的修改,只需要执行这一条命令即可

编译前配置

bash 复制代码
#安装hb
pip3 install --user ohos-build 
bash 复制代码
配置hb环境变量。
执行命令打开配置文件:vi ~/.bashrc ,
末尾添加:export PATH=~/.local/bin:$PATH
执行命令:source ~/.bashrc
源码根目录下执行命令:hb
相关推荐
提子拌饭1331 小时前
爆发效果技术——基于鸿蒙PC Electron框架实现
华为·架构·electron·开源·harmonyos·鸿蒙·鸿蒙系统
坚果派·白晓明1 小时前
鸿蒙PC三方库使用:使用 AtomCode + Skills 自动完成鸿蒙化三方库spdlog集成
c++·华为·ai编程·harmonyos·skills·atomcode·c/c++三方库
再见6581 小时前
【鸿蒙实战】从零开发「随机决策器」——选择困难症终结者
华为·harmonyos
国霄2 小时前
从编译产物看懂 ArkUI V2 `@BuilderParam` 的反应式陷阱
harmonyos
再见6586 小时前
鸿蒙Next实战开发(四):个人中心与系统设置页面开发
华为·harmonyos
坚果派·白晓明7 小时前
[鸿蒙PC三方库移植适配] 使用 AtomCode + Skills 自动完成spdlog鸿蒙化适配
c++·华为·ai编程·harmonyos·skills·atomcode
不爱学英文的码字机器7 小时前
[鸿蒙PC命令行移植适配]移植rust三方库sd到鸿蒙PC的完整实践
华为·rust·harmonyos
烛衔溟8 小时前
HarmonyOS 基础 UI 构建 —— 组件、布局与沉浸式效果
ui·华为·harmonyos
不爱吃糖的程序媛8 小时前
React Native 三方库 react-native-share 的 HarmonyOS 适配实战
react native·react.js·harmonyos
TrisighT8 小时前
Electron 的 printToPDF 在鸿蒙 PC 上翻车了,我换了个纯前端方案绕过去
electron·harmonyos