一键配置Ubuntu的OpenHarmony基础编译环境

news/2024/7/21 8:38:59 标签: harmonyos, OpenHarmony, ubuntu

OpenHarmony_1">一键配置Ubuntu的OpenHarmony基础编译环境

一、配置前说明

  • 该更新源仅适用于Ubuntu以下系列

    Ubuntu18.04

    Ubuntu20.04

    Ubuntu22.04

    强烈推荐Ubuntu20.04,本人使用的一直都是Ubuntu20.04

  • wsl的配置参见

    如果使用的window wsl安装,则关于wsl配置可参考: Win10电脑安装配置WSL方法

  • 如果是华为公司内网请慎重处理

二、一键自动化配置

一键自动化配置必须是root账号,自动化主要是配置以下功能:

  • apt源替换成国内的阿里云的源

  • 配置shbash

  • 配置usr/include/asm软连接

  • 安装UbuntuOpenHarmony的基础依赖包

  • git lfs安装

  • 配置repo工具

  • 安装vim

    这个是个人的vim配置,不需要可以安装完成后删除~/.vim~/.vimrc即可

apt-get -f -y install git
apt-get -f -y install dos2unix
git clone https://gitee.com/personal-summary/openharmony_env_init.git
cd openharmony_env_init
bash root_init.sh

如果不使用自动化,可以按照如下手动安装

三、apt源替换

sudo su
cd /etc/apt/
mv sources.list sources.list_bak
vim sources.list
添加以下内容到sources.list中

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
apt-get update
apt-get upgrade

四、root权限安装的工具包

4.1 直接安装的程序和依赖包(必须一个一个安装)

apt-get -f -y install apt-utils
apt-get -f -y install vim
apt-get -f -y install software-properties-common
apt-get -f -y install openssh-server
apt-get -f -y install iputils-ping
apt-get -f -y install curl
apt-get -f -y install net-tools
apt-get -f -y install bsdmainutils
apt-get -f -y install kmod
apt-get -f -y install bc
apt-get -f -y install rsync
apt-get -f -y install gawk
apt-get -f -y install ssh
apt-get -f -y install ccache
apt-get -f -y install zip
apt-get -f -y install python-dev
apt-get -f -y install make
apt-get -f -y install m4
apt-get -f -y install gcc-multilib
apt-get -f -y install ca-certificates-java
apt-get -f -y install unzip
apt-get -f -y install python3-yaml
apt-get -f -y install perl
apt-get -f -y install openssl
apt-get -f -y install libssl1.1
apt-get -f -y install gnupg
apt-get -f -y install xsltproc
apt-get -f -y install x11proto-core-dev
apt-get -f -y install tcl
apt-get -f -y install python3-crypto
apt-get -f -y install python-crypto
apt-get -f -y install libxml2-utils
apt-get -f -y install libxml2-dev
apt-get -f -y install libx11-dev
apt-get -f -y install libssl-dev
apt-get -f -y install libgl1-mesa-dev
apt-get -f -y install lib32z1-dev
apt-get -f -y install lib32ncurses5-dev
apt-get -f -y install g++-multilib
apt-get -f -y install flex
apt-get -f -y install bison
apt-get -f -y install doxygen
apt-get -f -y install git
apt-get -f -y install subversion
apt-get -f -y install tofrodos
apt-get -f -y install pigz
apt-get -f -y install expect
apt-get -f -y install python3-xlrd 
apt-get -f -y install git-core
apt-get -f -y install gperf 
apt-get -f -y install build-essential
apt-get -f -y install zlib1g-dev
apt-get -f -y install libc6-dev-i386
apt-get -f -y install lib32z-dev
apt-get -f -y install openjdk-8-jdk
apt-get -f -y install ruby
apt-get -f -y install mtools
apt-get -f -y install python3-pip
apt-get -f -y install gcc-arm-linux-gnueabi
apt-get -f -y install genext2fs
apt-get -f -y install liblz4-tool
apt-get -f -y install libssl-dev
apt-get -f -y install autoconf
apt-get -f -y install pkg-config
apt-get -f -y install zlib1g-dev
apt-get -f -y install libglib2.0-dev
apt-get -f -y install libmount-dev
apt-get -f -y install libpixman-1-dev
apt-get -f -y install libncurses5-dev
apt-get -f -y install exuberant-ctags
apt-get -f -y install silversearcher-ag
apt-get -f -y install libtinfo5
apt-get -f -y install device-tree-compiler
apt-get -f -y install libssl-dev
apt-get -f -y install libelf-dev
apt-get -f -y install dwarves
apt-get -f -y install gcc-arm-none-eabi
apt-get -f -y install default-jdk
apt-get -f -y install u-boot-tools
apt-get -f -y install mtd-utils
apt-get -f -y install scons
apt-get -f -y install automake
apt-get -f -y install libtinfo5
apt-get -f -y install gcc-multilib
apt-get -f -y install libtool
apt-get -f -y install libgmp-dev
apt-get -f -y install texinfo
apt-get -f -y install mpc
apt-get -f -y install autotools-dev
apt-get -f -y install libmpc-dev
apt-get -f -y install libmpfr-dev
apt-get -f -y install libgmp-dev
apt-get -f -y install patchutils
apt-get -f -y install libexpat-dev
apt-get -f -y install libfdt-dev
apt-get -f -y install libncursesw5-dev
apt-get -f -y install cmake
apt-get -f -y install wget
apt-get -f -y install libelf-devel

4.2 配置sh为bash

ls -l /bin/sh           		#如果显示为“/bin/sh -> bash”则为正常,否则请按以下方式修改: 
sudo dpkg-reconfigure dash   	#然后选择no

4.3 git lfs安装

curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs
apt install git-lfs
git lfs install

4.4 repo工具安装

curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > repo
chmod a+x repo
mv repo /usr/local/bin/

五、个人账号必须配置的工具

5.1 Git配置

git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global core.editor vim
git config --global credential.helper store

5.2 安装hb命令

# 方法一:
# 下载一套master分支的代码然后进入root目录下执行
pip3 install build/lite
vim ~/.bashrc
export PATH=$PATH:~/.local/bin
source ~/.bashrc

# 方法二:
python3 -m pip install --user ohos-build
vim ~/.bashrc
export PATH=$PATH:~/.local/bin
source ~/.bashrc

# 方法三:
# 安装指定版本,君正使用的是0.4.3
python3 -m pip install ohos-build==0.4.3
vim ~/.bashrc
export PATH=$PATH:~/.local/bin
source ~/.bashrc

5.3 卸载hb命令

pip3 uninstall ohos-build

http://www.niftyadmin.cn/n/192289.html

相关文章

转换CAJ到PDF:教你如何将CAJ文件转成PDF文件

CAJ文件格式是中国知网(CNKI)的专有文件格式,是一种用于存储和传输学术论文的文件格式。由于CAJ格式的特殊性,如果需要在其他平台上阅读或编辑,通常需要将其转换成更通用的文件格式,如PDF。本文将介绍如何将…

三轮全向底盘实现绘图功能

1. 功能说明 本文示例将实现R313a样机三轮全向底盘绘图(三角形、矩形、三叶草、正弦曲线)的功能。三轮全向底盘绘制图形有两种模式:第一种是自主选择模式(即通过按下开关进行模式的选项);第二种是上位机模式…

MySQL基础-子查询

文章目录MySQL基础-子查询一、子查询概念1、什么是子查询2、子查询的分类二、单行子查询1、单行比较操作符2、基本子查询3、HAVING 子查询4、CASE中的子查询5、子查询其他问题三、多行子查询1、多行比较操作符2、基本多行子查询3、空值问题四、相关子查询1、相关子查询概念2、基…

vscode安装与C/C++ 编译环境配置

一、前期准备 1、首先在微软官网下载并安装好visual stdio code,建议在安装时将选项全勾选上 User Installer版:会安装在当前计算机帐户目录,意味着如果使用另一个帐号登陆计算机将无法使用别人安装的vscode。 System Installer版:安装在非…

为什么在vscode中的某些 JSON 文件可以写注释 tsconfig.json setting.json

Start 番茄最近在学习 TypeScript,在编写 TypeScript 配置文件的时候,使用命令 tsc --init 自动生成的 tsconfig.json 。查看了这个 json 文件,有一个疑问出现在我脑海久久不能除去。为什么它可以在 JSON 文件中写注释? 1. 正文…

[Java] 文件 , InputStream, OutputStream

目录 初步了解计算机中的文件. 路径 文件的分类 一 . 文件系统操作 File 的相关操作 二 . 文件内容操作 字节流读操作 字符流操作 初步了解计算机中的文件. 文件 : 在平时我们认为的文件就是指存储在硬盘上的普通文件. 比如说 : txt , jpg , rar 等等. 都是指硬盘上的文件…

企业安全现状与未来趋势如何?

随着越来越多的第三方办公应用在企业的应用,以及越来越多的企业开始通过云计算、大数据、物联网等数字技术进行数字化转型,一些大企业几乎每秒就能产生上万条数据,这些数据都是企业的资产。 但是,在各种办公软件应用、数字技术给企…

实验1 数据获取、存储和预处理(网页爬虫 , 数据解析 , 数据库存取)

文章目录Part_1 爬虫Part_1_1 requests 库 向服务器请求数据1. SSL 安全认证2. 抛出异常 和 编码3.请求数据函数封装Part_1_2 布隆过滤器 BloomFilterPart_1_3 循环请求循环请求函数封装Part_2 BeautifulSoup 数据解析Part_2_1 Beautiful 函数Part_2_2 find 和 find_all 函数Pa…