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

在Xilinx ZYNQ上移植Ubuntu发行版

chanra1n1个月前 (05-10)Linux359


一、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://world.myfpga.cn/index.php/post/438.html https://world.myfpga.cn/index.php/post/439.html https://world.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-static sudo 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

echo 'Acquire::AllowInsecureRepositories "true";' > /etc/apt/apt.conf.d/99myconfig && \
    echo 'Acquire::AllowDowngradeToInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99myconfig

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://world.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...

Centos7 基于Docker安装OnlineJudge

Centos7 基于Docker安装OnlineJudge

点击访问青岛大学OnlineJudge GitHub地址首先你需要安装Docker,如果您并没有安装,您可以移步我们上一篇文章,那里介绍了如何安装Docker,https://world.myfpga.cn/?id=69如果您已经安装了Docker,现在请您运行以下内容一键安装OnlineJudge...

解决群晖使用AliDNS Debug和Session错误问题

解决群晖使用AliDNS Debug和Session错误问题

如您没有使用AliDNS请先移步该网站进行配置https://post.smzdm.com/p/571595/本文主要解决群辉运行ddns.py出现错误(debug错误、session问题)的问题任务计划修改为:cp /volume1/DISK/alidns/ddns.conf ...

iKuai-小白-1.3.4 16M固件

iKuai-小白-1.3.4 16M固件

iKuai-小白-1.3.4 16M编辑器备份固件.bin...

MW788刷NR285G固件

MW788刷NR285G固件

netcore(NR285G).zip...

NW788 MW788改NR285G教程及工具 附带CH341A 1.26版本 支持OTP写入 亲测改285成功

NW788 MW788改NR285G教程及工具 附带CH341A 1.26版本 支持OTP写入 亲测改285成功

285g读取1.bin支持(OTP分区)CH341A编程器1.26.rar原作者开发软件不容易,大家尽量购买正版设备,编程器软件烧写285固件的时候需要在选项里面选择主存储和OTP分区一块烧写淘宝买的1606E加密芯片(卖家坑爹,买了10个,发来有5个是MX258XX)看在包邮份上就不计较了存储芯片...