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

在Xilinx ZYNQ上移植Ubuntu发行版

chanra1n3天前Linux48


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

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://www.myfpga.cn/index.php/post/448.html

分享给朋友:

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

MW155R AR9331 刷机固件合集

MW155R AR9331 刷机固件合集

factory-to-ddwrt.binddwifi-ar71xx-generic-tl-wr710n-v1-squashfs-sysupgrade.binGECOOS_AP110T_QCA933X_5.6_2018102600.binlede-17.01.0-r3205-59508e3-ar71x...

小米路由器MINI刷爱快固件

小米路由器MINI刷爱快固件

uboot-xiaomi-mini-115200.binIK-MT7620AV4-H1S.bin...

MW788刷NR285G固件

MW788刷NR285G固件

netcore(NR285G).zip...

爱快登录面板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...

在Ubuntu/Linux环境中用Python进行FPGA编程和OpenCL应用开发

在Ubuntu/Linux环境中用Python进行FPGA编程和OpenCL应用开发

随着FPGA (Field Programmable Gate Array) 技术的快速发展,越来越多的开发者开始使用Ubuntu或Linux环境进行FPGA的编程和开发工作。在本文中,我们将会介绍如何在Ubuntu/Linux环境中使用Python作为编程语言进行FPGA开发,以及如何在这些环境中...