• 001——体验鸿蒙(基于I.MAX6ULL)


    目录

    一、下载资料

    二、体验鸿蒙

    三、编译Liteos-a


    用的韦东山老师的板子和资料,在它的基础上二次开发可以节约很多时间。我就剩45天了。

    一、下载资料

     

    二、体验鸿蒙

    看到老师的资料里有这张图

     这个很详细值得一看,我买的mini板

    需要用这个自研的软件进行烧入

    按照步骤

     

     大概就是USB启动,先跑UBOOT在跑鸿蒙

     成功启动后长这个样子

    体验了几个命令,这个文件系统和linux好像。

    但是命令的表现上有点奇怪

    三、编译Liteos-a

    wget --no-check-certificate -O Configuring_ubuntu.sh https://weidongshan.coding.net/p/DevelopmentEnvConf/d/DevelopmentEnvConf/git/raw/master/Configuring_ubuntu.sh && sudo chmod +x Configuring_ubuntu.sh && sudo ./Configuring_ubuntu.sh
    

    在ubuntu18.04上用他们提供的脚本配置一下开发环境

    我把它先下载下来看看都做了什么

    emm有点问题这个命令的地址有问题

    git clone https://e.coding.net/weidongshan/DevelopmentEnvconf.git
    

    现在用这个来下载

    颜色被关了都是白色太难区分了

    这里要设置一下

    现在就没问题了

    1. #!/bin/bash
    2. # -------------------------------------------------------------------------------
    3. # Filename: Configuring_Ubuntu.sh
    4. # Revision: 1.1
    5. # Date: 2020/01/10
    6. # Author: hceng
    7. # Author: li
    8. # Email: huangcheng.job@foxmail.com
    9. # Website: www.100ask.net
    10. # Function: Configuring the Ubuntu host environment.
    11. # Notes: Currently only supports Ubuntu16 and Ubuntu18.
    12. # -------------------------------------------------------------------------------
    13. #
    14. # Description:
    15. #1.Check env.
    16. # 1.1 check network
    17. # 1.2 check use root
    18. # 1.3 check set name
    19. #2.Install common software and configuration.
    20. # 2.1 configure vim
    21. # 2.2 configure tftp
    22. # 2.3 configure nfs
    23. # 2.4 configure samba
    24. #3.Install system tool for Linux or Android
    25. #
    26. # -------------------------------------------------------------------------------
    27. #define echo print color.
    28. RED_COLOR='\E[1;31m'
    29. PINK_COLOR='\E[1;35m'
    30. YELOW_COLOR='\E[1;33m'
    31. BLUE_COLOR='\E[1;34m'
    32. GREEN_COLOR='\E[1;32m'
    33. END_COLOR='\E[0m'
    34. PLAIN='\033[0m'
    35. #Set linux host user name.
    36. user_name=book
    37. # Check network.
    38. check_network() {
    39. ping -c 1 www.baidu.com > /dev/null 2>&1
    40. if [ $? -eq 0 ];then
    41. echo -e "${BLUE_COLOR}Network OK.${END_COLOR}"
    42. else
    43. echo -e "${RED_COLOR}Network failure!${END_COLOR}"
    44. exit 1
    45. fi
    46. }
    47. # Check user must root.
    48. check_root() {
    49. if [ $(id -u) != "0" ]; then
    50. echo -e "${RED_COLOR}Error: This script must be run as root!${END_COLOR}"
    51. exit 1
    52. fi
    53. }
    54. # Check set linux host user name.
    55. check_user_name() {
    56. cat /etc/passwd|grep $user_name
    57. if [ $? -eq 0 ];then
    58. echo -e "${BLUE_COLOR}Check the set user name OK.${END_COLOR}"
    59. echo -e "123456\n123456" | sudo passwd root
    60. else
    61. sudo useradd -m $user_name -G root -p 123456
    62. echo -e "123456\n123456" | sudo passwd $user_name
    63. sudo sh -c "echo \"$user_name ALL=(ALL:ALL) ALL\" >> /etc/sudoers"
    64. echo -e "${RED_COLOR}Add book user !${END_COLOR}"
    65. fi
    66. }
    67. # Check the results of the operation.
    68. check_status() {
    69. ret=$?
    70. if [ "$ret" -ne "0" ]; then
    71. echo -e "${RED_COLOR}Failed setup, aborting..${END_COLOR}"
    72. exit 1
    73. fi
    74. }
    75. # Get the code name of the Linux host release to the caller.
    76. get_host_type() {
    77. local __host_type=$1
    78. local the_host=`lsb_release -a 2>/dev/null | grep Codename: | awk {'print $2'}`
    79. eval $__host_type="'$the_host'"
    80. }
    81. # Select menu
    82. menu() {
    83. cat <<EOF
    84. `echo -e "\E[1;33mPlease select the host use:\E[0m"`
    85. `echo -e "\E[1;33m 1. Configuring for Harmony OS development \E[0m"`
    86. `echo -e "\E[1;33m 2. Configuring for Linux development\E[0m"`
    87. `echo -e "\E[1;33m 3. Configuring for Android development\E[0m"`
    88. `echo -e "\E[1;33m 4. Quit\E[0m"`
    89. EOF
    90. }
    91. #Set Ubuntu Source list address for aliyun
    92. SetUbuntuSourceList(){
    93. get_host_type host_release
    94. if [[ -f /etc/apt/sources.list.bak ]]; then
    95. echo -e " ${GREEN_COLOR}sources.list.bak exists${PINK_COLOR}"
    96. else
    97. mv /etc/apt/sources.list{,.bak}
    98. fi
    99. [ -f /etc/apt/sources.list ] && rm /etc/apt/sources.list
    100. echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" >>/etc/apt/sources.list
    101. echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" >>/etc/apt/sources.list
    102. echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse" >>/etc/apt/sources.list
    103. echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" >>/etc/apt/sources.list
    104. echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" >>/etc/apt/sources.list
    105. echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" >>/etc/apt/sources.list
    106. echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse" >>/etc/apt/sources.list
    107. echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse" >>/etc/apt/sources.list
    108. echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse" >>/etc/apt/sources.list
    109. echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse" >>/etc/apt/sources.list
    110. [ "$host_release" == "$ubuntu16" ] && sed -i 's/bionic/xenial/'g /etc/apt/sources.list
    111. [ "$host_release" == "$ubuntu18" ] && echo -n ""
    112. sleep 1
    113. apt-get update
    114. }
    115. # Configure vim form github.
    116. vim_configure() {
    117. git clone --depth=1 https://github.com/amix/vimrc.git /home/$user_name/.vim_runtime
    118. touch /home/$user_name/.vim_runtime/my_configs.vim
    119. echo "let g:go_version_warning = 0" > /home/$user_name/.vim_runtime/my_configs.vim
    120. chown -R $user_name /home/$user_name/.vim_runtime
    121. chmod u+x /home/$user_name/.vim_runtime/install_awesome_vimrc.sh
    122. su - $user_name -s /home/$user_name/.vim_runtime/install_awesome_vimrc.sh
    123. }
    124. # Configure tftp.
    125. tftp_configure() {
    126. tftp_file=/home/$user_name/tftpboot
    127. if [ ! -d "$tftp_file" ];then
    128. mkdir -p -m 777 $tftp_file
    129. fi
    130. grep "/home/book/tftpboot" /etc/default/tftpd-hpa 1>/dev/null
    131. if [ $? -ne 0 ];then
    132. sed -i '$a\TFTP_DIRECTORY="/home/book/tftpboot"' /etc/default/tftpd-hpa
    133. sed -i '$a\TFTP_OPTIONS="-l -c -s"' /etc/default/tftpd-hpa
    134. fi
    135. service tftpd-hpa restart
    136. }
    137. # Configure nfs.
    138. nfs_configure() {
    139. nfs_file=/home/$user_name/nfs_rootfs
    140. if [ ! -d "$nfs_file" ];then
    141. mkdir -p -m 777 $nfs_file
    142. fi
    143. grep "/home/book/" /etc/exports 1>/dev/null
    144. if [ $? -ne 0 ];then
    145. sed -i '$a\/home/book/ *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)' /etc/exports #todo
    146. fi
    147. service nfs-kernel-server restart
    148. }
    149. # Configure samba.
    150. samba_configure() {
    151. local back_file=/etc/samba/smb.conf.bakup
    152. if [ ! -e "$back_file" ];then
    153. cp /etc/samba/smb.conf $back_file
    154. fi
    155. check_status
    156. grep "share_directory" /etc/samba/smb.conf 1>/dev/null
    157. if [ $? -ne 0 ];then
    158. sed -i \
    159. '$a[share_directory]\n\
    160. path = \/home\/book\n\
    161. available = yes\n\
    162. public = yes\n\
    163. guest ok = yes\n\
    164. read only = no\n\
    165. writeable = yes\n' /etc/samba/smb.conf
    166. fi
    167. /etc/init.d/samba restart
    168. #chmod -R 777 /home/book/
    169. }
    170. # Execute an action.
    171. FA_DoExec() {
    172. echo -e "${BLUE_COLOR}==> Executing: '${@}'.${END_COLOR}"
    173. eval $@ || exit $?
    174. }
    175. # Install openharmony for Linux
    176. install_openharmony_software() {
    177. local ubuntu16=("xenial")
    178. local ubuntu18=("bionic")
    179. get_host_type host_release
    180. if [ "$host_release" = "$ubuntu16" ]
    181. then
    182. echo "This Ubuntu version is not supported"
    183. else
    184. if [ "$host_release" = "$ubuntu18" ]
    185. then
    186. wait
    187. sudo apt-get install python3.8 dosfstools mtools python3-setuptools python3-pip -y
    188. wait
    189. sudo rm -f /usr/bin/python
    190. sudo ln -s /usr/bin/python3.8 /usr/bin/python
    191. wget https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar
    192. wait
    193. tar -xvf gn.1523.tar -C ~/
    194. wget https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar
    195. wait
    196. tar -xvf ninja.1.9.0.tar -C ~/
    197. wget https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar
    198. wait
    199. tar -xvf llvm-linux-9.0.0-34042.tar -C ~/
    200. wait
    201. wget https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar
    202. wait
    203. tar -xvf hc-gen-0.65-linux.tar -C ~/
    204. echo "export PATH=~/ninja:~/llvm/bin:~/hc-gen:~/gn:${PATH}" >> ~/.bashrc
    205. source ~/.bashrc
    206. sudo pip3 install kconfiglib
    207. echo "OK "
    208. sudo rm -rf /bin/sh
    209. sudo ln -s /bin/bash /bin/sh
    210. ls -la /bin/sh
    211. else
    212. echo "This Ubuntu version is not supported"
    213. exit 0
    214. fi
    215. fi
    216. }
    217. # Install common software and configuration
    218. install_common_software() {
    219. apt-get update
    220. check_status
    221. local install_software_list=("ssh" "git" "vim" "tftp" "nfs" "samba")
    222. echo -e "${BLUE_COLOR}install_software_list: ${install_software_list[*]}.${END_COLOR}"
    223. #install ssh
    224. if (echo "${install_software_list[@]}" | grep -wq "ssh");then
    225. apt-get -y install openssh-server && echo -e "${BLUE_COLOR}ssh install completed.${END_COLOR}"
    226. fi
    227. #install git
    228. if (echo "${install_software_list[@]}" | grep -wq "git");then
    229. apt-get -y install git && echo -e "${BLUE_COLOR}git install completed.${END_COLOR}"
    230. fi
    231. #install and configure vim
    232. #if (echo "${install_software_list[@]}" | grep -wq "vim");then
    233. #apt-get -y install vim && vim_configure && echo -e "${BLUE_COLOR}vim install completed.${END_COLOR}"
    234. #fi
    235. #install and configure tftp
    236. if (echo "${install_software_list[@]}" | grep -wq "tftp");then
    237. apt-get -y install tftp-hpa tftpd-hpa && tftp_configure && echo -e "${BLUE_COLOR}tftp install completed.${END_COLOR}"
    238. fi
    239. #install and configure nfs
    240. if (echo "${install_software_list[@]}" | grep -wq "nfs");then
    241. apt-get -y install nfs-kernel-server && nfs_configure && echo -e "${BLUE_COLOR}nfs install completed.${END_COLOR}"
    242. fi
    243. #install and configure samba
    244. if (echo "${install_software_list[@]}" | grep -wq "samba");then
    245. apt-get -y install samba && samba_configure && echo -e "${BLUE_COLOR}samba install completed.${END_COLOR}"
    246. fi
    247. }
    248. install_user_software() {
    249. wget https://weidongshan.coding.net/p/DevelopmentEnvConf/d/DevelopmentEnvConf/git/raw/master/mkimage.stm32
    250. chmod +x mkimage.stm32
    251. sudo mv mkimage.stm32 /usr/bin/
    252. }
    253. # Install software for Linux
    254. install_linux_software() {
    255. local ubuntu16=("xenial")
    256. local ubuntu18=("bionic")
    257. get_host_type host_release
    258. if [ "$host_release" = "$ubuntu16" ]
    259. then
    260. FA_DoExec apt-get install mtd-utils curl gcc make git vim python net-tools openssh-server \
    261. python-dev build-essential subversion \
    262. libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext \
    263. gfortran libssl-dev libpcre3-dev xlibmesa-glu-dev libglew1.5-dev \
    264. libftgl-dev libmysqlclient-dev libfftw3-dev libcfitsio-dev graphviz-dev \
    265. libavahi-compat-libdnssd-dev libldap2-dev libxml2-dev p7zip-full \
    266. libkrb5-dev libgsl0-dev u-boot-tools lzop bzr device-tree-compiler android-tools-mkbootimg -y
    267. else
    268. if [ "$host_release" = "$ubuntu18" ]
    269. then
    270. echo '* libraries/restart-without-asking boolean true' | sudo debconf-set-selections
    271. FA_DoExec apt-get install curl mtd-utils gcc make git vim python net-tools openssh-server \
    272. python-dev build-essential subversion \
    273. libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext \
    274. gfortran libssl-dev libpcre3-dev xlibmesa-glu-dev libglew1.5-dev \
    275. libftgl-dev libmysqlclient-dev libfftw3-dev libcfitsio-dev graphviz-dev \
    276. libavahi-compat-libdnssd-dev libldap2-dev libxml2-dev p7zip-full bzr \
    277. libkrb5-dev libgsl0-dev u-boot-tools lzop -y
    278. else
    279. echo "This Ubuntu version is not supported"
    280. exit 0
    281. fi
    282. fi
    283. }
    284. # Install software for Android
    285. install_android_software() {
    286. local ubuntu16=("xenial")
    287. local ubuntu18=("bionic")
    288. get_host_type host_release
    289. if [ "$host_release" = "$ubuntu16" ]
    290. then
    291. FA_DoExec add-apt-repository ppa:openjdk-r/ppa
    292. FA_DoExec apt-get update
    293. FA_DoExec apt-get install openjdk-7-jdk
    294. FA_DoExec update-java-alternatives -s java-1.7.0-openjdk-amd64
    295. FA_DoExec java -version
    296. FA_DoExec apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 libc6-dev-i386 \
    297. libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib \
    298. tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
    299. dpkg-dev libsdl1.2-dev libesd0-dev \
    300. git-core gnupg flex bison gperf build-essential \
    301. zip curl zlib1g-dev gcc-multilib g++-multilib \
    302. lib32ncurses5-dev x11proto-core-dev libx11-dev \
    303. lib32z-dev ccache squashfs-tools libncurses5-dev pngcrush schedtool libxml2\
    304. libgl1-mesa-dev unzip m4 lzop libc6-dev lib32z1-dev \
    305. libswitch-perl libssl1.0.0 libssl-dev
    306. else
    307. if [ "$host_release" = "$ubuntu18" ]
    308. then
    309. FA_DoExec apt-get install openjdk-8-jdk openjdk-8-jre
    310. FA_DoExec java -version
    311. FA_DoExec apt-get install m4 g++-multilib gcc-multilib \
    312. lib32ncurses5-dev lib32readline6-dev lib32z1-dev flex curl bison
    313. FA_DoExec apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib \
    314. git flex bison gperf build-essential libncurses5-dev:i386 \
    315. dpkg-dev libsdl1.2-dev libesd0-dev \
    316. git-core gnupg flex bison gperf build-essential \
    317. zip curl zlib1g-dev gcc-multilib g++-multilib \
    318. libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev \
    319. libgl1-mesa-dev libxml2-utils xsltproc unzip m4 \
    320. lib32z1-dev ccache make tofrodos \
    321. python-markdown libxml2-utils xsltproc zlib1g-dev:i386 lzop -y
    322. else
    323. echo "This Ubuntu version is not supported"
    324. exit 0
    325. fi
    326. fi
    327. }
    328. check_network
    329. check_root
    330. check_user_name
    331. menu
    332. while true
    333. do
    334. read -p "please input your choice:" ch
    335. case $ch in
    336. 1)
    337. SetUbuntuSourceList
    338. install_common_software
    339. install_linux_software
    340. install_openharmony_software
    341. install_user_software
    342. echo -e "${GREEN_COLOR}===================================================${END_COLOR}"
    343. echo -e "${GREEN_COLOR}== Configuring for openharmony development complete! ==${END_COLOR}"
    344. echo -e "${GREEN_COLOR}===================================================${END_COLOR}"
    345. echo -e "${BLUE_COLOR}TFTP PATH: $tftp_file ${END_COLOR}"
    346. echo -e "${BLUE_COLOR}NFS PATH: $nfs_file ${END_COLOR}"
    347. echo -e "${BLUE_COLOR}SAMBA PATH: /home/book/ ${END_COLOR}"
    348. su $user_name
    349. ;;
    350. 2)
    351. SetUbuntuSourceList
    352. install_common_software
    353. install_linux_software
    354. install_user_software
    355. echo -e "${GREEN_COLOR}===================================================${END_COLOR}"
    356. echo -e "${GREEN_COLOR}== Configuring for Linux development complete! ==${END_COLOR}"
    357. echo -e "${GREEN_COLOR}===================================================${END_COLOR}"
    358. echo -e "${BLUE_COLOR}TFTP PATH: $tftp_file ${END_COLOR}"
    359. echo -e "${BLUE_COLOR}NFS PATH: $nfs_file ${END_COLOR}"
    360. echo -e "${BLUE_COLOR}SAMBA PATH: /home/book/ ${END_COLOR}"
    361. su $user_name
    362. ;;
    363. 3)
    364. SetUbuntuSourceList
    365. install_common_software
    366. install_linux_software
    367. install_android_software
    368. install_user_software
    369. echo -e "${GREEN_COLOR}===================================================${END_COLOR}"
    370. echo -e "${GREEN_COLOR}== Configuring for Android development complete! ==${END_COLOR}"
    371. echo -e "${GREEN_COLOR}===================================================${END_COLOR}"
    372. echo -e "${BLUE_COLOR}TFTP PATH: $tftp_file ${END_COLOR}"
    373. echo -e "${BLUE_COLOR}NFS PATH: $nfs_file ${END_COLOR}"
    374. echo -e "${BLUE_COLOR}SAMBA PATH: /home/book/ ${END_COLOR}"
    375. su $user_name
    376. ;;
    377. 4)
    378. break
    379. exit 0
    380. ;;
    381. *)
    382. clear
    383. echo "Sorry, wrong selection"
    384. exit 0
    385. ;;
    386. esac
    387. done
    388. exit 0

            可以自动配置非常的方便但是你如果不像改变自己原来的配置的话最好把需要的地方提取一下只改要改的。

    curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > repo

    sudo cp repo  /usr/local/bin/repo && sudo chmod a+x /usr/local/bin/repo

    sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple requests

    其实就是从git上拿这个命令下来放到本地pip3下载是的这个韦东山老师说安装失败没关系

    repo命令是管理多个git仓库的,源码很多我不放了,大家感兴趣用命令下载完自己看

    然后创建个目录放源码并下载源码

    显示丰富的颜色这里选择yes就行

    repo sync -c -j8

    repo sync -c -j8 是一个在 Android 源代码的获取和管理工具 repo 中使用的命令。这个命令主要用于同步多个 Git 仓库的内容。下面是各个选项的解释:

    • sync: 这是 repo 的一个子命令,用于同步所有托管的项目。
    • -c: 这个选项的意思是“当前分支”(current branch)。使用 -c 选项时,repo sync 会确保每个仓库都同步到它们各自的当前分支的最新状态。如果不使用 -crepo sync 会尝试同步到 manifest 文件中为每个仓库指定的修订版本(revision)。
    • -j8: 这个选项用于指定并发的任务数。在这里,-j8 表示 repo sync 会并发地执行 8 个任务来同步仓库。并发数可以根据你的系统资源进行调整。增加并发数可以加快同步过程,但也可能导致系统资源紧张。

    所以,repo sync -c -j8 的整体意思是:同步所有托管的项目到它们各自的当前分支的最新状态,并且使用 8 个并发任务来执行这个操作。

    这一步用了足足半小时

    “OpenHarmony-1.0”。别被“1.0”误导了,它内核在GITEE里的分支版本,同属“鸿蒙2.0”。

    下载完我们用官方的版本验证一下环境

    好,没有clang,哎下个新虚拟机按韦东山老师的脚本配置一下环境吧。

    又是一个小时

    真的是难顶

    报错咯,系统自动更新把安装工具占用了

    要么等一会儿要么直接重启,这里我选择直接重启了,没时间等咯

    又又又又又卡死了,服了呀,下次买个贵点的电脑,同时开三个虚拟机它承受了它不该承受的

    配置完了

    repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony-1.0

    git记得登录哦

    第一次执行可能会报错,网络的问题再来一遍就行

    下载补丁文件

    git clone CODING | 一站式软件研发管理平台

     

    试一下没问题。也可以远程看代码。

  • 相关阅读:
    Java电子招投标采购系统源码-适合于招标代理、政府采购、企业采购、等业务的企业
    java中类A的所有实例方法都可以在A的子类中进行覆盖(Override)吗
    Viola-Jones检测器(VJ)---学习笔记
    机器学习策略篇:详解为什么是ML策略?(Why ML Strategy?)
    React笔记(九)RTK
    青少年python系列 35.自定义函数
    内网开发之后端配置前端项目流程
    卡尔曼滤波的推导
    基于Spring Boot开发的汽车租赁管理系统
    灰度发布专题---1、灰度发布的意义和方案
  • 原文地址:https://blog.csdn.net/qq_52479948/article/details/136711142