赞
踩
1.创建操作系统 Ubuntu20.04 + Docker
2.安装可视化界面(可跳过)
sudo -i
sudo apt-get update
sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal ubuntu-desktop
3.关机,重置实例密码
4.开机,进入可视化界面安装中文操作环境(可跳过)
cd /
sudo vim etc/apt/sources.list
按下**ctrl
** + :
进入命令模式
输入**%d
**删除所有内容
按下**ESC
**
粘贴以下内容
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted
按下**ctrl
** + :
进入命令模式
输入**wq
**
更新源
sudo apt-get update
使用如下**apt-get
**命令安装编译所需的必要的库和工具:
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi cpio device-tree-compiler net-tools openssh-server git vim openjdk-11-jre-headless
打开Linux编译服务器终端。
输入如下命令,查看python版本号,若为python3.7+可跳过安装Python3步骤:
python3 --version
设置python和python3软链接为python3.8。
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
安装并升级Python包管理工具(pip3)
sudo apt-get install python3-setuptools python3-pip -y
sudo pip3 install --upgrade pip
运行如下命令安装hb
python3 -m pip install --user ohos-build
设置环境变量
vim ~/.bashrc
将以下命令拷贝到.bashrc文件的最后一行,保存并退出。
export PATH=~/.local/bin:$PATH
执行如下命令更新环境变量。
source ~/.bashrc
执行"hb -h",有打印以下信息即表示安装成功:
usage: hb
OHOS build system
positional arguments:
{build,set,env,clean}
build Build source code
set OHOS build settings
env Show OHOS build env
clean Clean output
optional arguments:
-h, --help show this help message and exit
新建tools目录
mkdir ~/tools
下载mkimage.stm32工具,并复制到/home/bearpi/tools/目录下
mkimage.stm32下载地址: https://pan.baidu.com/s/1T2O8luJ0-8g5ZZYdOvWfqQ 提取码:1234
执行以下命令修改mkimage.stm32工具权限
chmod 777 ~/tools/mkimage.stm32
设置环境变量
vim ~/.bashrc
将以下命令拷贝到.bashrc文件的最后一行,保存并退出。
export PATH=~/tools:$PATH
执行如下命令更新环境变量。
source ~/.bashrc
鼠标焦点移到MobaXterm
在MobaXterm中输入:
cd /home/ubuntu
然后回车
在MobaXterm中输入:
mkdir project && cd project
然后回车
在MobaXterm中输入以下命令获取源码:
git clone https://gitee.com/bearpi/bearpi-hm_micro_small.git -b master
然后回车,等待1-3分钟(根据不同网速)
在MobaXterm中输入以下指令,进入源码根目录
cd /home/ubuntu/project/bearpi-hm_micro_small/
在MobaXterm中输入:
hb set
再输入"."(点)
.
在MobaXterm中输入:
hb build -t notest --tee -f
然后回车,等待直到屏幕出现:build success
字样,说明编译成功。
查看编译出的固件位置
当编译完后,在Windows中可以直接查看到最终编译的固件,具体路径在:
cd project/bearpi-hm_micro_small/out/bearpi_hm_micro/bearpi_hm_micro/
其中有以下文件是后面烧录系统需要使用的。
在MobaXterm中执行以下三条指令将以上三个文件复制到applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/
下,以便后续烧录系统使用
cp out/bearpi_hm_micro/bearpi_hm_micro/OHOS_Image.stm32 applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/
cp out/bearpi_hm_micro/bearpi_hm_micro/rootfs_vfat.img applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/
cp out/bearpi_hm_micro/bearpi_hm_micro/userfs_vfat.img applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/
参考链接:
https://gitee.com/bearpi/bearpi-hm_micro_small
```
deb http://mirrors.tencentyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.tencentyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.tencentyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb http://mirrors.tencentyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.tencentyun.com/ubuntu/ focal-updates main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-proposed main restricted universe multiverse
#deb-src http://mirrors.tencentyun.com/ubuntu/ focal-backports main restricted universe multiverse
```
sudo i
sudo apt-get update
sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal ubuntu-desktop
首先查看是否安装了中文语言包
locale -a
查看是否有:
zh_CN.utf8
如果没有,首先需要安装中文语言包,输入以下命令:
sudo apt-get update
sudo apt-get install language-pack-zh-hans
然后添加中文支持
sudo locale-gen zh_CN.UTF-8
修改locale文件配置
sudo vim /etc/default/locale
修改配置文件为:
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh:en_US:en"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
sudo reboot
参考链接:
https://www.pianshen.com/article/1700298521/
安装过程如下:
sudo apt install xrdp
安装完成xrdp 服务将会自动启动,可以输入下面的命令验证它:
sudo systemctl status xrdp
默认情况下,xrdp 使用/etc/ssl/private/ssl-cert-snakeoil.key
,它仅仅对ssl-cert用户组成语可读,所以需要运行下面的命令,将xrdp用户添加到这个用户组:
sudo adduser xrdp ssl-cert
sudo systemctl restart xrdp
然后使用Windows自带的远程桌面软件连接服务器IP地址或者域名就行了。
参考链接:
https://zhuanlan.zhihu.com/p/336429888
sudo passwd xxx
vim /etc/cloud/cloud.cfg
preserve_hostname: true
sudo vim /etc/hostname
参考https://zhuanlan.zhihu.com/p/372994818
mv A.php B.php #修改文件名
rm A.cpp #删除文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
#卸载libreOffice
sudo apt-get remove libreoffice-common -y
#删除Amazon的链接
sudo apt-get remove unity-webapps-common -y
#删除不常用的软件
sudo apt-get remove thunderbird totem rhythmbox empathy brasero simple-scan gnome-mahjongg aisleriot onboard deja-dup -y
sudo apt-get remove gnome-mines cheese transmission-common gnome-orca gnome-sudoku -y
sudo apt autoremove
用于可视化配置docker
sudo docker volume create portainer_data
sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
参考链接:
https://cloud.tencent.com/developer/article/1840508?from=article.detail.1831170
汉化教程链接:
https://www.quchao.net/Portainer-CN.html
先列出有哪些容器(列出所有的):docker ps -a
显示所有容器:docker ps -a
只显示容器ID:docker ps -q
要先暂停容器,才能删除:
暂停所有容器:docker stop $(docker ps -aq)
暂停单个容器:docker stop < CONTAINER ID >
删除容器:
删除所有容器:docker rm $(docker ps -aq)
删除单个容器:docker rm < CONTAINER ID >
强制删除 -f, --force:docker rm -f < CONTAINER ID >
删除指定链接-l, --link:docker rm -l < CONTAINER ID >
删除容器关联数据卷-v --volumes:docker rm -v < CONTAINER ID >
列出镜像:docker images
删除镜像:
删除单个镜像:docker rmi < IMAGE ID >
删除所有镜像:docker rmi $(docker images -q)
遇见关联镜像删除不了时,强制删除:docker rmi -f $(docker images -q)
注:不明白的命令使用 --help查询
参考链接:
https://blog.csdn.net/KingJin_CSDN_/article/details/107007705
打开配置文件
vim ~/.bash_profile
添加以下代码
if [ -f ~/.bashrc ] ; then
source .bashrc
fi
参考链接:
https://www.jianshu.com/p/35ad1b375e50
https://zhuanlan.zhihu.com/p/412930421
新建可执行文件
vim Hmbuild.sh
添加以下代码
#!/bin/bash
hb build &&
cp out/bearpi_hm_micro/bearpi_hm_micro/OHOS_Image.stm32 applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/&&
cp out/bearpi_hm_micro/bearpi_hm_micro/rootfs_vfat.img applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/&&
cp out/bearpi_hm_micro/bearpi_hm_micro/userfs_vfat.img applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/
echo "编译完成并将文件复制到目录:"
echo "applications/BearPi/BearPi-HM_Micro/tools/download_img/kernel/"
修改文件权限
chmod +x Hmbuild.sh
使用方法
./Hmbuild.sh
参考链接:
https://www.cnblogs.com/hhxxgdd/p/11847503.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。