电脑系统盘出故障了,重新安装了Ubunt20.04(之前用的是18.04)。日常工作编译基于Rockchip和AM335x系列芯片的内核和U-boot比较多,所以先搭建它们的开发环境(包括并不限依赖的库和常用工具)并记录如下。

注:因为很多命令来自网络或官方文档,所以安装过程中可能重复安装某个工具或软件,无关大雅。

执行如下安装命令:

sudo apt-get update

sudo apt-get install flex -y

sudo apt-get install libssl-dev -y

sudo apt-get install liblz4-tool -y

sudo apt-get install genext2fs -y

sudo apt install byobu vim-gtk inetutils-ping net-tools wget cpio unzip rsync xz-utils -y

sudo apt install curl git tree -y

sudo apt install build-essential -y

sudo apt-get install openssh-server openssh-client -y

=============================================

下面要安装的工具的命令来自于Rockchip的文档:

sudo apt-get install repo git ssh make gcc libssl-dev liblz4-tool \

expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \

qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib \

unzip device-tree-compiler python-pip ncurses-dev pyelftools -y

直接执行遇到错误了:

…...

Reading state information... Done

Note, selecting 'libncurses-dev' instead of 'ncurses-dev'

Package python-pip is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source

However the following packages replace it:

python3-pip

E: Unable to locate package repo

E: Package 'python-pip' has no installation candidate

E: Unable to locate package pyelftools

根据错误提示,对于找不到包的暂时不安装,先安装其他的,因此重新执行下面的命令:

sudo apt-get install git ssh make gcc libssl-dev liblz4-tool \

expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \

qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib \

unzip device-tree-compiler libncurses-dev -y

这次没有发现报错了。

安装npm:

sudo apt install npm

安装 NotePad++:

sudo snap install notepad-plus-plus

error: cannot perform the following tasks:

- 下载 snap "notepad-plus-plus" (367),来自频道 "stable" (Get https://canonical-lgw01.cdn.snapcraftcontent.com/download-origin/canonical-lgw01/155ZvKiCILXt4S5Ro8YZmzKHgNPPedVj_367.snap?interactive=1&token=1655298000_bf2a037c7c2dc6f8139356f186b9517091f016cb: read tcp 192.168.9.192:51620->185.125.190.26:443: read: connection reset by peer)

上面的安装方法失败了,尝试用下面的方法安装NotePad++:

sudo add-apt-repository ppa:notepadqq-team/notepadqq

sudo apt-get update

sudo apt-get install notepadqq

(这里报错日志忘记保存了)这次还是失败了,失败的原因是无法访问相应的源(虽然公司可以访问外网)。

新增阿里源后,再次安装就可以了。

===========================================

新增阿里源方法:https://developer.aliyun.com/article/699524?spm=a2c6h.17698244.wenzhang.5.477c29787wYskb

注:这里完全参考上面的文章来的,仅仅作了小小的改动。

首先查看自己的Ubuntu系统的Codename(别名/代号),这一步很重要,直接导致更新的源是否对系统起效果,查看方法:

$ lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 20.04.3 LTS

Release: 20.04

Codename: focal

虽然lsb_release输出了想要的东西,但是“No LSB modules are available.”却是标准错误输出。

解决:

sudo apt-get install lsb-core

安装后再次查看:

$ lsb_release -a

LSB Version: core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch

Distributor ID: Ubuntu

Description: Ubuntu 20.04.3 LTS

Release: 20.04

Codename: focal

因为我的系统是Ubunt 20.04,所以Codename是focal。

备份系统源:

cd /etc/apt

sudo cp sources.list sources.list_bak

这里为了方便直接以root账号(一般地,即使是个人电脑,都尽量不要切换到root账户执行命令)执行如下命令:

Codename=$( (lsb_release -a) | awk '{print $2}' | tail -n 1 )

echo "\

deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe

deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe

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

deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe

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

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

deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe ">sources.list.2

然后将sources.list.2里面的内容复制到sources.list的末尾。

最后执行: sudo apt-get update

===========================================

# 前面安装repo失败了,下面继续安装:

先cd到家目录,然后执行:

$ mkdir files

上面新建一个目录的目的是以后下载的安装工具都保存在这里。非必须。

$ cd files/

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/files/repo

$ ls

repo

$ cp repo /usr/local/bin/repo

cp: cannot create regular file '/usr/local/bin/repo': Permission denied

$ sudo cp repo /usr/local/bin/repo

$ sudo chmod a+x /usr/local/bin/repo

测试:

$ repo init

/usr/bin/env: ‘python’: No such file or directory

失败了,提示没有python,但实际上,系统里面已经安装了python2和python3

在/usr/bin/目录下为python2创建软链:

sudo ln -s /usr/bin/python2 /usr/bin/python

再运行 repo init,这次没有报错了。

=============================================

Ubuntu 20.04 上安装 VMware,免破解

系统需要满足以下基本硬件要求

i) 1.3GHz或更快的64位CPU

ii) 建议至少 4GB RAM 或更大

# 首先安装依赖

sudo apt update

sudo apt install build-essential linux-headers-generic -y

# 然后下载

wget --user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" https://www.vmware.com/go/getplayer-linux

# 最后安装

chmod +x getplayer-linux

sudo ./getplayer-linux --required --eulas-agreed

=============================================

# VMware安装的Windows虚拟机和主机(Ubuntu20.04)共享文件夹

sudo apt-get install samba -y

sudo apt-get install smbclient -y

# 创建共享目录

$ mkdir ~/share

# 使用如下命令打开配置文件,进行编辑samba配置文件

sudo gedit /etc/samba/smb.conf

# 在文件末尾追加如下内容:

[UBUNTU-SHARE]

comment = share

read only = no

locking = no

path = /home/xxx/share

guest ok = yes

# 其中的“path = /home/xxx/share”就是创建的共享目录,一定要是绝对路径!

# 重启服务

sudo systemctl restart smbd.service

# 查看状态是否OK

sudo systemctl status smbd.service

# 最后,需要在虚拟机中设置:点击“Virtual Machine" --> "Virtual Machine settings" --> "Options" --> "Shared folders", 然后在左边添加共享目录即可。

=============================================

AM335x 交叉编译工具安装

$ tar xzf poky-glibc-i686-core-image-sato-cortexa8hf-vfp-neon-toolchain-1.8.1.tar.gz

注:这里的工具是从同事那里直接拷贝的,请自行在网络上搜你的期望的工具。

ls

poky-glibc-i686-core-image-sato-cortexa8hf-vfp-neon-toolchain-1.8.1.sh poky-glibc-i686-core-image-sato-cortexa8hf-vfp-neon-toolchain-1.8.1.tar.gz

$ ./poky-glibc-i686-core-image-sato-cortexa8hf-vfp-neon-toolchain-1.8.1.sh

Enter target directory for SDK (default: /opt/poky/1.8.1):

You are about to install the SDK to "/opt/poky/1.8.1". Proceed[Y/n]?y

[sudo] password for xxx:

Extracting SDK...done

Setting it up...done

SDK has been successfully set up and is ready to be used.

$ ls /opt/poky/1.8.1/

environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi site-config-cortexa8hf-vfp-neon-poky-linux-gnueabi sysroots version-cortexa8hf-vfp-neon-poky-linux-gnueabi

$ ls /opt/poky/1.8.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/bin/arm*-gcc

/opt/poky/1.8.1/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/bin/arm-poky-linux-gnueabi-gcc

# 编译脚本增加:

source /opt/poky/1.8.1/environment-setup-cortexa8hf-vfp-neon-poky-linux-gnueabi

export CROSS_COMPILE=arm-poky-linux-gnueabi-

到此,在我的机器上尝试编译am335x和RK3399的内核都成功了。如果你遇到错误,可以根据报错提示去解决。

######### 其他说明 #########

# arm-none-eabi:这个是没有操作系统的,自然不可能支持那些跟操作系统关系密切的函数,比如fork(2)。他使用的是newlib这个专用于嵌入式系统的C库。

# arm-none-linux-eabi:用于Linux的,使用Glibc

# arm-poky is the default compiler of yocto in linux for armv7, while gcc-arm is the compiler from gnu for embedded system

# 不同的交叉编译工具配置不同,比如之前编译用的交叉工具为:

# export CROSS_COMPILE=arm-none-linux-gnueabihf-

# export PATH=~/Desktop/latest_sdk/sdk_install/linux-devkit/sysroots/x86_64-arago-linux/usr/bin:$PATH

# Refer to : https://www.cnblogs.com/jzcn/p/14889438.html

# Refer to : https://blog.csdn.net/guodeqiangde/article/details/78239408

错误在所难免,欢迎指正,谢谢!

在Ubuntu 20.04上面搭建嵌入式开发环境相关推荐

  1. Ubuntu 20.04 上搭建 LEMP/LAMP 环境运行 WordPress

    Ubuntu 20.04 上搭建 LEMP 环境运行 WordPress Wordpress 是最流行的内容管理系统之一,也是常用的 CMS(内容管理系统)程序之一.Wordpress 可以在 VPS ...

  2. Ubuntu 11.04上搭建Android开发环境

    本文给大家讲解下如何在Ubuntu 11.04环境下使用Eclipse, Android SDK和 PhoneGap搭建Android开发环境. #1,安装Eclipse 和 Android SDK/ ...

  3. Ubuntu 20.04 日常软件及开发环境安装命令,包括QQ、搜狗、Chrome、vlc、网易云音乐安装方法(待整理!!!)

    1 简介 Ubuntu 16.04安装完后,还需要做一些配置才能愉快的使用,包括添加软件源.安装搜狗输入法.Chrome浏览器.网易云音乐.配置快捷键.安装git等等,下面就跟着我来配置吧,just ...

  4. Ubuntu 20.04.4配制pPX4开发环境

    PX4官方指南 Ubuntu Development Environment | PX4 User Guide 一.从PX4的官方给github拉取代码 1.进入主目录,进入到你要存PX4的文件夹,我 ...

  5. 乌班图系统我的世界服务器手机版,如何在Ubuntu 20.04上搭建Minecraft服务器

    <我的世界>是有史以来最受欢迎的游戏之一.本教程说明了如何在Ubuntu 20.04上制作Minecraft服务器.我们将使用Systemd运行Minecraft服务器,并使用该mcrco ...

  6. Ubuntu 16.04下配置openWRT开发环境

    Ubuntu 16.04下配置openWRT开发环境 1.配置openwrt开发环境,本实验室在ubuntu16.04系统下测试 在编译之前我们先要搭建环境,ubuntu下OpenWrt编译环境需要安 ...

  7. ubuntu16.04上搭建stm32f4开发环境

    ubuntu16.04上搭建stm32f4开发环境 工程源码的地址 https://github.com/txson/ubuntu-stm32 欢迎大家参与修改 搭建交叉编译环境 stm32 属于ar ...

  8. 虚拟机安装我的世界服务器,如何在Ubuntu 20.04上搭建我的世界Minecraft服务器

    本文说明了如何在Ubuntu 20.04上制作Minecraft服务器.我们将使用Systemd运行Minecraft服务器,并使用该mcrcon实用程序连接到正在运行的实例.还将向您展示如何创建执行 ...

  9. 【Ubuntu 20.04安装和深度学习环境搭建 4090显卡】

    Ubuntu安装步骤参考文章 知乎:Ubuntu 20.04系统安装及初始配置 目录 一. 制作启动盘 1.1 下载镜像文件 1.2 制作启动盘 二. 安装系统 2.1 启动计算机并进入BIOS 2. ...

最新文章

  1. 面试题: 难点 已看1
  2. 除了 iOS 和 Android,世界第三大移动系统是什么?
  3. centos输入正确的账号和密码登陆不进去
  4. Linux 软件的安装
  5. 转载 用ShadowVolume画模型的影子
  6. win2003系统网络安装——基于linux+pxe+dhcp+tftp+samba+ris
  7. Nginx 反向代理时获取用户的真实 IP
  8. emc re 整改 超标_老刘工程师睡前故事5-EMC 辐射发射超标怎么办?
  9. SurfaceView的绘图机制
  10. [Javascript]把html内容复制到剪贴板
  11. Ubuntu Software Center has closed unexpectly解决方案
  12. 工作效率的提升——如何高效沟通,有效降低沟通成本
  13. 单片机/开发板连接配置的三种方式
  14. 矩阵分解(三)——满秩分解
  15. filters 传参是什么_vue中filters 传入两个参数 / 使用两个filters的实现方法
  16. 数显之家快讯:【SHIO世硕心语】2021年,中国最赚钱的时代到来!
  17. 2020年网络安全国赛解析(仅个人想法)
  18. 加载java ie停止工作_OpenLayers webapplication在IE11中停止工作
  19. 朱一龙左娜扎右热巴,王栎鑫:我想活成你的样子
  20. tensorflow2.0 dqn 深度强化学习 AI自动玩游戏,有详细注解

热门文章

  1. 【ML特征工程】第 7 章 :通过K-Means 模型堆叠进行非线性特征化
  2. 大学计算机实验教程制作电子小报,word中电子小报怎么做?word电子小报的图文教程...
  3. 怎样找回u盘里误删的文件
  4. 计算机考研301数学一攻略,国家海洋技术中心
  5. 咪蒙微信公众号已被注销 酷玩实验室因不实报道道歉
  6. docker超强总结,docker这一篇就够了
  7. 2018noip模拟 烷基
  8. nasm预处理器(1)
  9. 【论文】联邦学习区块链 论文集(一)
  10. 微信移动学习平台小程序 后台基于php+mysql