当前位置:首页 > Linux > 正文内容

在Xilinx ZYNQ上移植Ubuntu发行版

chanra1n2天前Linux31


一、ZYNQ启动流程原理

ZYNQ的启动过程分为三个阶段:

  1. FSBL (First Stage Boot Loader)

    • 由Vivado/Vitis生成,负责初始化PS端硬件(如DDR、时钟、外设)

    • 加载PL端比特流(FPGA配置)

    • 移交控制权给第二阶段引导程序(如U-Boot)

  2. U-Boot (第二阶段引导程序)

    • 从存储设备(如SD卡)加载Linux内核、设备树和初始化文件系统

    • 设置启动参数(如控制台、根文件系统位置)

    • 启动内核并将控制权交给Linux

  3. Linux内核与根文件系统

    • 内核初始化操作系统核心功能(进程管理、内存管理等)

    • 挂载根文件系统(rootfs),执行初始化脚本(如/sbin/init

    Ubuntu的发行版特性由rootfs决定,与内核解耦->所以我们能很方便的进行移植

二、移植过程

1、使用Petalinux生成FSBL、U-Boot、内核和设备树

petalinux-config --get-hw-description=<hdf_dir>  # 导入硬件描述
petalinux-build                                  # 编译工程
petalinux-package --boot --fsbl --fpga --u-boot # 打包BOOT.BIN

这个过程可以参考我之前写的文章:https://myfpga.cn/index.php/post/438.html https://myfpga.cn/index.php/post/439.html https://myfpga.cn/index.php/post/440.html 

2、下载根文件系统

访问http://cdimage.ubuntu.com/ubuntu-base/releases/ 里面有对应的Ubuntu Base,注意如果设备是ZYNQ7000系列的,需要选择armhf。如果是Ultrascle以上的(包括Versal)需要选择arm64。

3、挂载系统文件并进行基本配置

mkdir ~/zynq_rootfs
cd ~/zynq_rootfs
wget  
tar zxvf ./ubuntu-base-*

sudo apt-get install qemu-user-staticsudo cp /usr/bin/qemu-aarch64-static ~/zynq_rootfs/usr/bin/
sudo cp -b /etc/resolv.conf ~/zynq_rootfs/etc/resolv.conf

sudo tee ~/zynq_rootfs/etc/apt/source.list <<'EOF'
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy main universe restricted
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy main universe restricted
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ jammy-backports main restricted universe multiverse
EOF

sudo tee ./ch-mount.sh <<'EOF'
#!/bin/bashfunction help() {
    echo ""
    echo "usage: ch-mount.sh [-m <path>] [-u <path>] <command> [<args>]"
    echo ""
    echo "For example: bash ch-mount.sh -m /media/sdcard/"
    echo ""}while getopts "m:u:" argdo
    case $arg in
        m)
            echo "I:MOUNTING"
            sudo mount -t proc /proc ${2}proc            sudo mount -t sysfs /sys ${2}sys            sudo mount -o bind /dev ${2}dev            sudo mount -o bind /dev/pts ${2}dev/pts        
            sudo chroot ${2}
            ;;
        u)
            echo "I:UNMOUNTING"
            sudo umount ${2}proc            sudo umount ${2}sys            sudo umount ${2}dev/pts            sudo umount ${2}dev            ;;
        ?)
            echo "E:Unknow parameter"
            help
            exit 1
    esacdone
EOF

sudo bash ch-mount.sh -m ~/zynq_rootfs/

4、切换到文件系统中后,安装必备软件包(方便操作),

apt-get install language-pack-en-base sudo locales ssh screen net-tools ethtool wireless-tools ifupdown iperf3 network-manager iputils-ping rsyslog bash-completion htop vim resolvconf --no-install-recommends -y
locale-gen en_US.UTF-8
locale-gen zh_CN.UTF-8
update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
apt-get install apt-utils dialog -y
apt-get install perl-modules-5.30 -y
dpkg-reconfigure debconf
clear
echo "ubuntu-arm-zynq">/etc/hostname
echo "127.0.0.1 localhost">>/etc/hosts
echo "127.0.1.1 ubuntu-arm-zynq">>/etc/hosts
dpkg-reconfigure resolvconf
dpkg-reconfigure tzdata

最后根据你的板卡信息,修改/etc/fstab

# <file system>   <dir>         <type>    <options>                          <dump> <pass>
/dev/mmcblk1p2    /             ext4      defaults,noatime,errors=remount-ro   0      1
/dev/mmcblk1p1    /boot/uboot   vfat      defaults,noatime                     0      0




引用:本文参考了https://blog.csdn.net/Markus_xu/article/details/117020452


扫描二维码推送至手机访问。

版权声明:本文由我的FPGA发布,如需转载请注明出处。

本文链接:https://myfpga.cn/index.php/post/448.html

分享给朋友:

“在Xilinx ZYNQ上移植Ubuntu发行版” 的相关文章

CentOS安装Transmission离线下载

CentOS安装Transmission离线下载

#请直接复制代码 yum install wget vim screen -y && screen -dmS Transmission  yum groupinstall...

有效部署阿里云DDNS+Python环境

有效部署阿里云DDNS+Python环境

第一步复制以下代码并生成api,代码转自CSDN,并经过优化修改请将代码保存为1.sh 然后使用sodu su 1.sh 运行代码,输入1后按回车键等待安装完成echo "请输入序号选择你要干啥:   输入1. 升级到Python 2.7...

一键升级Centos6 Python至2.7.9 并安装宝塔

一键升级Centos6 Python至2.7.9 并安装宝塔

#直接复制运行命令即可 curl -o install.sh http://download.myfpga.cn/linux/centos/pythonandbt.sh && sh install.sh...

爱快登录面板API

爱快登录面板API

接口名:登录面板API接口地址:路由器管理地址+/Action/login接口调用方式:POST参数1:username    用户名参数2:passwd    密码,为输入密码的MD5加密,32位小写参数3:pass&...

仅IPV6的VPS安装AWVS 13.x 14.x 并使用DNS NAT服务访问IPV4网页 教程展示Ubuntu18.x环境配置

仅IPV6的VPS安装AWVS 13.x 14.x 并使用DNS NAT服务访问IPV4网页 教程展示Ubuntu18.x环境配置

测试通过的环境:centos7 Ubuntu18.x1、使用root登录vps2、打开DNS NAT服务,通过修改DNS解析文件设置echo -e "nameserver 2001:67c:2b0::4\nameserver 2001:67c:2b0...

(挂机赚钱)任意Arm/X86架构Win/Linux安装猕猴桃CDN教程 树莓派 OrangePi 友善之臂 ArmCortex9

(挂机赚钱)任意Arm/X86架构Win/Linux安装猕猴桃CDN教程 树莓派 OrangePi 友善之臂 ArmCortex9

前言这应该是全网第一个任意Arm架构的猕猴桃安装教程,我已经安装实现了。想跑猕猴桃,点击右侧链接官网注册→, https://www.bdkjcdn.com/register X86平台X86  i386 Linux/Windows 等的部署请点击->宽带变现 每...