新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 在 Zynq MPSoC 上運行 DOOM 游戲

        在 Zynq MPSoC 上運行 DOOM 游戲

        作者: 時間:2016-08-03 來源:電子產(chǎn)品世界 收藏

          PetaLinux

        本文引用地址:http://www.104case.com/article/201608/294978.htm

          PetaLinux 工具包含一個命令集,以便讓用戶在賽靈思 FPGA 和 SoC 上輕松創(chuàng)建和擴展 Linux 系統(tǒng)。該演示使用 petalinux-build 和 petalinux-boot 命令。petalinux-build 命令用于創(chuàng)建全部所需的組件。petalinux-boot 命令(外加幾個變量)用于啟動在 QEMU 仿真器上運行的所有組件。介紹 PetaLinux 工具中的所有命令超出了本文的范圍,但是通過此演示系統(tǒng)應(yīng)該很容易發(fā)掘這兩個命令和其他命令的功能。參考PetaLinux 工具文檔 — 參考指南 UG1144 (v2015.4) 了解更多信息。

          項目先決條件

          該項目需要一個運行 Linux 的工作站或虛擬機,具有滿足 UG1144 (v2015.4) 中所列的 PetaLinux 工具安裝要求的環(huán)境,而且環(huán)境中需要安裝賽靈思 PetaLinux Tools v2015.4 版本。

          一旦 Doom 啟動,你就可以使用鍵盤和鼠標(biāo)控制游戲。應(yīng)記住,可能需要點擊 ESC 鍵來開始游戲。開始游戲咯!

          步驟 1:構(gòu)建 ROOTFS

          首先,我們需要構(gòu)建 rootFS。從賽靈思下載 doom_demo.tar.gz,打開下載目錄中的一個 terminal;你可在以下網(wǎng)址中找到全部所需文件: www.wiki.xilinx.com/Doom+on+Xen+Demo。我們將該目錄稱為 。

          解壓文檔。

          $ cd

          $ tar -xzf doom_demo.tar.gz && cd doom_demo

          我們會看到一個文件夾,我們將把它存到根文件系統(tǒng)(一個用于 Dom0,另一個用于 DomU)。現(xiàn)在,我們需要構(gòu)建 PrBoom,并復(fù)制到 rootFS。

          首先,需要下載 Linux 內(nèi)核,這樣我們隨后就可以構(gòu)建 rootFS。我們使用 v4.3 標(biāo)簽。

          $ git clone -b v4.3 https://github.com/tor- valds/linux.git

          下載 Buildroot 源文件,并更改到 Buildroot 目錄。

          $ git clone https://git.buildroot.net/buildroot && cd buildroot

          現(xiàn)在我們需要配置 Buildroot,以構(gòu)建可以使用的套件。

          $ make menuconfig

          我們選擇以下選項:

          Target options ---> Target Architecture ---> AArch64 (little endian)

          Target packages —> Games ---> prboom ---> [*]

          Target packages —> Games ---> shareware Doom WAD file ---> [*]

          應(yīng)自動選擇全部所需的庫。

          $ make # (這需要幾分鐘時間,取決于機器。)

          現(xiàn)在,我們將所有 PrBoom 相關(guān)文件復(fù)制到 targetfs 目錄,確保我們在 buildroot 目錄下的 ./output/target/ 目錄。

          $ for i in $(find ./-name ‘*oom*’); do cp ${i}

          /doom_demo/targetfs/${i}; done

          現(xiàn)在,我們完成了 Buildroot 操作。我們移到上一個目錄 doom_demo 目錄。

          $ make # Build the host and guest rootFS.(這需要幾分鐘時間,取決于你的機器。)

          注意:可能還存在額外配置選項,這主要取決于使用的內(nèi)核版本。這些額外配置選項未被我們提供的配置預(yù)先選擇。使用默認(rèn)選項即可(需點擊回車鍵)。

          步驟 2:構(gòu)建基礎(chǔ)設(shè)置

          接下來,我們?yōu)槠脚_構(gòu)建嵌入式系統(tǒng)軟件的剩余部分,包括引導(dǎo)裝載程序、ARM Trusted Firmware (ATF)、Linux 內(nèi)核和設(shè)備樹。賽靈思的 PetaLinux 工具讓這個過程簡單直觀。我們創(chuàng)建一個針對賽靈思 ZCU102 開發(fā)板的 PetaLinux 項目。參考 2015.4 UG1144 和 AR#66249 中 QEMU 和 PetaLinux 的快速入門材料。訪問china.xilinx.com ,將 ZCU102 BSP (板支持包)下載到目錄下。

          $ cd

          $ petalinux-create --type project -s

          / Xilinx-ZCU102-v2015.4-final.bsp -- name doom_demo_zynqMP

          這樣將在 /doom_demo_zynqMP 中創(chuàng)建我們的 PetaLinux 項目。

          我們轉(zhuǎn)到 PetaLinux 項目,并構(gòu)建 PetaLinux。

          $ cd /doom_demo_zynqMP

          $ petalinux-build

          現(xiàn)在,我們需要為本用例手動編輯設(shè)備樹。

          編輯 xen-overlay.dtsi 文件 (subsystems/linux/ configs/device-tree/xen-overlay.dtsi)。

          將 dom0 下的 'reg = <0x0 0x80000 0x3100000>;' 替換為 'reg = <0x0 0x80000 0x4100000>;'

          將 dom0 下的 'xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=512M bootscrub=0 maxcpus=1 time r_ slop=0";' 替換為 'xen,xen-bootargs = "console=dtuart dtuart=serial0 dom0_mem=512M bootscrub=0 maxcpus=4 timer_ slop=0";'

          將 dom0 下的 'xen,dom0-bootargs = "console=hvc0 earlycon=xen earlyprintk=xen maxcpus=1";' 替換為 'xen,dom0-bootargs = "rdinit=/bin/sh console=hvc0 earlycon=xen earlyprintk=xen maxcpus=4";'

          編輯 zynqmp.dtsi 文件 (subsystems/linux/configs/ device-tree/zynqmp.dtsi)。

          將 dom0 下的 'compatible = "cdns,uart-r1p12";' 替換為 'compatible = "cdns,uart-r1p8", "cdns,uart-r1p12";' 現(xiàn)在,手動構(gòu)建 Xen 設(shè)備樹。

          $ dtc -I dts -O dtb -i ./subsystems/linux/con- figs/device-tree/ -o ./images/linux/xen.dtb ./ subsystems/linux/configs/device-tree/xen.dts

          最后,我們需要將 Peta- Linux 構(gòu)建的 rootFS 替換為我們此前構(gòu)建的 rootFS。之所以這樣做,是因為 PetaLinux 不包含 PrBoom,因為我們提供自己的 rootFS。我們還需要將 xen.ub 鏡像替換為賽靈思預(yù)先構(gòu)建的鏡像,因為 Xen 和 Xen 工具版本必須匹配。

          $ rm /doom_demo_zynqMP/images/linux/ Image && rm /doom_demo_zynqMP/images/ linux/xen.ub

          $ cp /doom_demo/Image /doom_ demo_zynqMP/images/linux/Image && cp / doom_demo/xen.ub /doom_demo_zynqMP/im- ages/linux/xen.ub

          使用 u-boot 引導(dǎo)加載程序引導(dǎo)。

          $ petalinux-boot --qemu --u-boot --qemuargs= "- net nic -net nic -net nic -net nic -net us- er,net=192.168.129.0,dhcpstart=192.16

          8.129.50,host=192.168.129.1,hostfwd=t cp:127.0.0.1:5900-192.168.129.50:5900"

          > setenv serverip 192.168.129.1

          > tftpb 4000000 xen.dtb; tftpb 0x80000 Image; tftpb 6000000 xen.ub; bootm 6000000 - 4000000

          # /boot.sh

          # /xen-doom.sh 1



        關(guān)鍵詞: Zynq MPSoC

        評論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 诏安县| 邢台县| 同仁县| 泰安市| 招远市| 玉田县| 通许县| 阿克| 仁布县| 虹口区| 光泽县| 鹤庆县| 古蔺县| 武鸣县| 沂南县| 杨浦区| 江华| 中卫市| 监利县| 襄城县| 文水县| 墨玉县| 利川市| 汝城县| 集贤县| 丹凤县| 嫩江县| 墨竹工卡县| 安阳县| 舟曲县| 抚松县| 若尔盖县| 静乐县| 增城市| 台南县| 肥东县| 长宁县| 小金县| 伊通| 武功县| 福海县|