【技術文章】使用Kria K26 eMMC 開機在Ubuntu OS 上

本文章將教學如何使用KV260開發板,將上面更換為量產版的K26 SOM,使用上面的emmc開機進入ubuntu作業系統。

教學開始

如下圖所示,首先建立一個Vivado專案。在這裡提醒您,若要使用KV260預設的Vivado設定,務必選擇連接Vision AI Starter Kit Carrier Card。

按「Next」進行下一步後,即建立Block Design,並且加入一個Mpsoc,然後點選上方的Run Block Automation,加載KV260板子預先設定。

建立好Block Design設計後,按照下圖流程操作一遍,然後產生Bitstream。

匯出您的硬體xsa,然後包含您的Bitstream。

建立Petalinux專案 (備註:不要使用kv260的BSP)
source /tools/Xilinx/Petalinux/2022.2/settings.sh
petalinux-create -t project --template zynqMP --name k26_emmc_ubuntu

進入專案
cd k26_emmc_ubuntu/


加載剛剛從vivado匯出的xsa
petalinux-config --get-hw-description=../Kv260_k26_vivado/
調整設定 Image Packaging Configuration 裡面的設定,然後存檔離開。

編譯Petalinux
petalinux-build


打包BOOT.bin
petalinux-package --boot --fsbl --fpga --pmufw --atf --u-boot –force


將SD卡分區,第一磁區使用FAT32,第二磁區使用ext4
sudo partitionmanager

將Petalinux編譯出來在image/linux下的BOOT.BIN & image.ub & boot.scr 複製到第一磁區


https://ubuntu.com/download/amd-xilinx下載檔案(檔名為:iot-limerick-kria-classic-desktop-2204-x06-20220614-78.img.xz)
並解壓縮(備註:解壓縮的檔案為iot-limerick-kria-classic-desktop-2204-x06-20220614-78.img)

iot-limerick-kria-classic-desktop-2204-x06-20220614-78.img複製進SD卡第二磁區,並且改名為kria_ubuntu_2204_20220614.img
cp /home/hube/iot-limerick-kria-classic-desktop-2204-x06-20220614-78.img
hdd/kria_ubuntu_2204_20220614.img

然後將SD卡插入KV260中。

掛載剛剛用Linux主機分區的第二磁區資料或者到 /run/media/mmcblk1p2查看kria_ubuntu_2204_20220614.img是否存在。

使用 sudo dd if=/run/media/mmcblk1p2/kria_ubuntu_2204_20220614.img of=/dev/mmcblk0 bs=4M

拔出SD卡,將卡片插回電腦,使用Vivado燒錄SD卡的Boot.bin

Fsbl,使用Petalinux編譯出來的。

重新開機,您將進入emmc中的ubuntu。

附錄

若您在Petalinux建立的時候使用BSP,有可能出現下方顯示的問題,或者正常開機:

xilinx-kv260-starterkit-20222 login: Xilinx Zynq MP First Stage Boot Loader

Release 2022.2   Oct  7 2022  -  04:56:16

MultiBootOffset: 0x0

Reset Mode      :       System Reset

Platform: Silicon (4.0), Running on A53-0 (64-bit) Processor, Device Name: XCZUUNKNEG

SD1 with level shifter Boot Mode

Non authenticated Bitstream download to start now

PL Configuration done successfully

▒NOTICE:  BL31: v2.6(release):xlnx_rebase_v2.6_2022.1_update3-18-g0897efd45

NOTICE:  BL31: Built : 03:55:03, Sep  9 2022

 

 

U-Boot 2022.01 (Sep 20 2022 - 06:35:33 +0000)

 

CPU:   ZynqMP

Silicon: v3

PMUFW no permission to change config object

Detected name: zynqmp-sm-k26-xcl2gc-rev1 -sck-kv-g-revB

Model: ZynqMP SMK-K26 Rev1/B/A

Board: Xilinx ZynqMP

DRAM:  4 GiB

PMUFW:  v1.1

PMUFW no permission to change config object

Xilinx I2C FRU format at nvmem0:

 Manufacturer Name: XILINX

 Product Name: SM-K26-XCL2GC

 Serial No: XFL1YH0FPVGN

 Part Number: 5057-02

 File ID: 0x0

 Revision Number: 1

Xilinx I2C FRU format at nvmem1:

 Manufacturer Name: XILINX

 Product Name: SCK-KV-G

 Serial No: 50581B213V79

 Part Number: 5066-01ED

 File ID: 0x0

 Revision Number: B

EL Level:       EL2

Chip ID:        xck26

NAND:  0 MiB

MMC:   mmc@ff160000: 0, mmc@ff170000: 1

Loading Environment from nowhere... OK

In:    serial

Out:   serial

Err:   serial

Bootmode: LVL_SHFT_SD_MODE1

Reset reason:   EXTERNAL

Net:   PHY reset timed out

 

ZYNQ GEM: ff0e0000, mdio bus ff0e0000, phyaddr 1, interface rgmii-id

 

Warning: ethernet@ff0e0000 MAC addresses don't match:

Address in ROM is               ff:ff:ff:ff:ff:ff

Address in environment is       00:0a:35:0f:d3:29

eth0: ethernet@ff0e0000

gpio: pin gpio@ff0a000038 (gpio 38) value is 0

gpio: pin gpio@ff0a000038 (gpio 38) value is 1

starting USB...

Bus usb@fe200000: Register 2000440 NbrPorts 2

Starting the controller

USB XHCI 1.00

scanning bus usb@fe200000 for devices... 4 USB Device(s) found

       scanning usb for storage devices... 0 Storage Device(s) found

Hit any key to stop autoboot:  0

SM-K26-XCL2GC: No match

switch to partitions #0, OK

mmc0(part 0) is current device

Scanning mmc 0:1...

Found U-Boot script /boot.scr.uimg

5980 bytes read in 15 ms (388.7 KiB/s)

## Executing script at 20000000

Selecting DT for Kria boards

Kria DT: #conf-smk-k26-revA-sck-kv-g-revB

Configuring the cma value based on the board type

cma=1000M

Loading image.fit

74448580 bytes read in 5737 ms (12.4 MiB/s)

## Loading kernel from FIT Image at 10000000 ...

   Using 'conf-smk-k26-revA-sck-kv-g-revB' configuration

   Trying 'kernel-1' kernel subimage

     Description:  Ubuntu kernel

     Created:      2022-06-14  11:00:09 UTC

     Type:         Kernel Image

     Compression:  gzip compressed

     Data Start:   0x100000ec

     Data Size:    19160045 Bytes = 18.3 MiB

     Architecture: AArch64

     OS:           Linux

     Load Address: 0x00200000

     Entry Point:  0x00200000

     Hash algo:    sha1

     Hash value:   10f900494ab6c08729a1c5d2b1bb8f8b13c67e30

   Verifying Hash Integrity ... sha1+ OK

## Loading ramdisk from FIT Image at 10000000 ...

   Using 'conf-smk-k26-revA-sck-kv-g-revB' configuration

   Trying 'ramdisk-1' ramdisk subimage

     Description:  Ubuntu ramdisk

     Created:      2022-06-14  11:00:09 UTC

     Type:         RAMDisk Image

     Compression:  uncompressed

     Data Start:   0x11245dcc

     Data Size:    55075360 Bytes = 52.5 MiB

     Architecture: AArch64

     OS:           Linux

     Load Address: unavailable

     Entry Point:  unavailable

     Hash algo:    sha1

     Hash value:   0d688311fae323e3751e1f3a2e9c2fcc35f5be97

   Verifying Hash Integrity ... sha1+ OK

## Loading fdt from FIT Image at 10000000 ...

   Using 'conf-smk-k26-revA-sck-kv-g-revB' configuration

   Trying 'fdt-smk-k26-revA-sck-kv-g-revB.dtb' fdt subimage

     Description:  Flattened device tree blob - smk-k26-revA-sck-kv-g-revB

     Created:      2022-06-14  11:00:09 UTC

     Type:         Flat Device Tree

     Compression:  uncompressed

     Data Start:   0x146f514c

     Data Size:    42270 Bytes = 41.3 KiB

     Architecture: AArch64

     Load Address: 0x44000000

     Hash algo:    sha1

     Hash value:   816905477954dd504b8e0a85b1366ca3f6876551

   Verifying Hash Integrity ... sha1+ OK

   Loading fdt from 0x146f514c to 0x44000000

   Booting using the fdt blob at 0x44000000

   Uncompressing Kernel Image

   Loading Ramdisk to 75b79000, end 78fff220 ... OK

   Loading Device Tree to 000000000fff2000, end 000000000ffff51d ... OK

 

Starting kernel ...

 

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]

[    0.000000] Linux version 5.15.0-1010-xilinx-zynqmp (buildd@bos02-arm64-012) (gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #11-Ubuntu SMP Tue Jun 7 15:25:24 UTC 2022 (Ubuntu 5.15.0-1010.11-xilinx-zynqmp 5.15.30)

[    0.000000] Machine model: ZynqMP SMK-K26 Rev1/B/A

 

……

 

[    6.398421] 0x000000080000-0x000000100000 : "Image Selector Golden"

[    6.404260] xlnx-drm xlnx-drm.0: bound fd4a0000.display (ops zynqmp_dpsub_component_ops [zynqmp_dpsub])

[    6.421860] 0x000000100000-0x000000120000 : "Persistent Register"

[    6.525210] 0x000000120000-0x000000140000 : "Persistent Register Backup"

[    6.534932] 0x000000140000-0x000000200000 : "Open_1"

[    6.546438] 0x000000200000-0x000000f00000 : "Image A (FSBL, PMU, ATF, U-Boot)"

[    6.553272] 0x000000f00000-0x000000f80000 : "ImgSel Image A Catch"

[    6.556630] 0x000000f80000-0x000001c80000 : "Image B (FSBL, PMU, ATF, U-Boot)"

[    6.558960] 0x000001c80000-0x000001d00000 : "ImgSel Image B Catch"

[    6.570332] 0x000001d00000-0x000001e00000 : "Open_2"

[    6.571927] 0x000001e00000-0x000002000000 : "Recovery Image"

[    6.573227] 0x000002000000-0x000002200000 : "Recovery Image Backup"

[    6.578098] 0x000002200000-0x000002220000 : "U-Boot storage variables"

[    6.584199] 0x000002220000-0x000002240000 : "U-Boot storage variables backup"

[    6.588625] 0x000002240000-0x000002250000 : "SHA256"

[    6.592977] 0x000002250000-0x000004000000 : "User"

[    6.660594] Console: switching to colour frame buffer device 128x48

[    6.727050] random: fast init done

[    6.727141] zynqmp-display fd4a0000.display: [drm] fb0: xlnxdrmfb frame buffer device

[    6.797174] [drm] Initialized xlnx 1.0.0 20130509 for fd4a0000.display on minor 0

[    6.805619] zynqmp-display fd4a0000.display: ZynqMP DisplayPort Subsystem driver probed

[    6.819890] mmc1: new high speed SDHC card at address aaaa

[    6.826103] mmcblk1: mmc1:aaaa SB32G 29.7 GiB

[    6.837707]  mmcblk1: p1 p2 p3

[    6.915643] da9121 1-0033: Device detected (device-ID: 0x05, var-ID: 0x21, DA9131)

[    6.945027] da9121 1-0032: Device detected (device-ID: 0x05, var-ID: 0x20, DA9130)

[    7.183049] random: crng init done

[    7.823886] async_tx: api initialized (async)

AMD XILINX 相關諮詢

安馳科技 Max Pan

Max.pan@anstek.com.tw