UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer redgatorsmp
Observer
140 Views
Registered: ‎07-01-2019

ZCU102 OSL Flow + 2018.2 (Centos 7.6-1810) on ZCU102 Rev 1.1 and some observations

Jump to solution

This has to do with the Wiki posting here:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841722/ZCU102+Image+creation+in+OSL+flow

I have managed to build this with 2018.2 (the article is baselined on 2017.4). However, along the way I have discovered many craters that I felt I should share:

  • If you are using "csh" or a variant, stop it right now - you're short-changing yourself, and "csh" was never secure and never will be.
  • The brief assumes you have Petalinux installed; it should also recommend that you set up to use the Petalinux tools environment for your session. For my 2018.2 environment, I find the following to be necessary:
source <petalinux-install>/settings.sh
PATH=$PATH:<Xilinx-SDK-install>/SDK/2018.2/bin
export SWT-GTK3=0

 

 

  • The brief assumes a base directory, but doesn't do a good job of referencing back to that base directory. The path to your project is referenced as "<Your Path>" in places. I would recommend something like this at the very top, and then doing a "cd $p" at the top of each code block to get you oriented.
export p=<Your Path> # where <Your Path> is replaced with the full path to your project base directory
  • To build with 2018.2 versus 2017.4, just replace the "xilinx-v2017.4" with "xilinx-v2018.2" wherever it appears.
  • PARALLEL MAKE DOES NOT WORK EVERYWHERE... - parallel make (make -jX, where X is the number of concurrent makes) looks to be toxic on all but u-boot and Linux builds.
  • Build FSBL - there is a "cd embeddedsw", then "cd embeddedsw/lib/sw_apps/zynqmp_fsbl"; the second command should be "cd lib/sw_apps/zynqmp_fsbl" as you are already in the "embeddedsw" directory.
  • Build FSBL - apparently this was done early on, and the "make" command refers to the "zcu102-es2" (Engineering Sample 2) board. Probably good to use "zcu102" (as I did with my rev 1.1 board) or the board that matches your own. For this model only "zcu102" and "zcu102-es2" are referenced in "embddedsw".
  • Build device-tree - I used a "system.hdf" from a previous Petalinux project - the same file is available in the BSP if you un-gzip it someplace and look in "project-spec/hw-description/system.hdf".
  • Build device-tree - This is just confusing because it leaves steaming ploppers in un-obvious places. The DTS products ends up in "$p/my_dts/system-top.dts"
  • For noobs like me, expecially linux-centric noobs like me, "Launch HSI" is confusing. You meant "run 'hsi'". This is apparently one of those commands that is completely "under the covers" if you use the Petalinux flow, so you've never seen this:
$ hsi

****** hsi v2018.2 (64-bit)
  **** SW Build 2258646 on Thu Jun 14 20:02:38 MDT 2018
    ** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.

hsi%

 

  • Also, "hsi" accepts commands from stdin, so you can assembling commands in the shell and just pipe them to an instance of "hsi".
  • The "gem3" modification code has a syntax error: "&&phy0" should be "&phy0". The "dtc" will pick up the error and issue a nice diagnostic.
  • The "gem3" modification is necessary to get networking working, and the process in the brief works - just append the source segment to the end of "$p/my_dts/system-top.dts". The recommended verification is confusing - the compilation process does replacements, so you would want to look for these strings in the output. Example: I compiled the DTS without and with the replacement, dumped the DTB back to a DTS, and then compared them. The following block appears in the updated DTB:
771a772,782
>                         local-mac-address = [00 0a 35 00 02 90];
>                         phy-handle = <0x12>;
>
>                         phy@c {
>                                 reg = <0xc>;
>                                 ti,rx-internal-delay = <0x8>;
>                                 ti,tx-internal-delay = <0xa>;
>                                 ti,fifo-depth = <0x1>;
>                                 linux,phandle = <0x12>;
>                                 phandle = <0x12>;
>                         };

 

 

 

  • Create SD Image - the BIF file contains typo on the 5th line "embedded/..." should be "embeddedsw/..."
  • Create SD Image - look for "<<YOUR .bit FILE>> - I used the system.bit file from the pre-built created by "petalinux-build" in a previous attempt. This image is also available from the BSP if you un-gzip it someplace.
  • Create SD Image - Creating the FIT image - the title says "fitimage.its" and then the code says "fitImage.its". Windows would not care, Linux gets confused. Use fitImage.its
  • Create SD Image - fitImage.its - the "ftd@0" entry calls out "./my_dts/system.dtb" - this should be "./my_dts/system-top.dtb".
  • Create SD Image - the "ramdisk@0" uses a cpio filesystem image - I used one from a previous Petalinux build in "pre-built" - it's also available if you un-gzip the BSP
  • If you load and run the BOOT.BIN and fitImage.itb from an SDcard as indicated, you will get the following frightening messages:
    switch to partitions #0, OK
    mmc0 is current device
    Device: sdhci@ff170000
    Manufacturer ID: 3
    OEM: 5344
    Name: SL16G
    Tran Speed: 50000000
    Rd Block Len: 512
    SD version 3.0
    High Capacity: Yes
    Capacity: 14.8 GiB
    Bus Width: 4-bit
    Erase Group Size: 512 Bytes
    ** Unable to read file system.dtb **
    ## Error: "distro_bootcmd" not defined
    ZynqMP>
     Let not your heart be troubled: "system.dtb" does not exist because the ITB was structured with "system-top.dtb". All of the u-boot scripts assume "system.dtb". Use "printenv" to see all of the boot scripts, which execute in the following order:
  • ZynqMP> printenv bootcmd
    bootcmd=run $modeboot || run distro_bootcmd
    ZynqMP> printenv modeboot
    modeboot=sdboot
    ZynqMP> printenv sdboot
    sdboot=mmc dev $sdbootdev && mmcinfo && run uenvboot || run sdroot$sdbootdev; load mmc $sdbootdev:$partid $fdt_addr system.dtb && load mmc $sdbootdev:$partid $kernel_addr Image && booti $kernel_addr - $fdt_addr
    So either the ITB needs to reference "system.dtb" or the boot scripts need to be changed to reference "system-top.dtb". (Haven't decided which is the right thing to do yet.)
  • Bottom line - you get these messages, you are at the "stop at uboot" place in the process.

For giggles, I scripted these steps so that I can reproduce my own work, again assuming you've set up the Petalinux tools environment and set the "p" environment variable to your product directory full path:

build_fsbl.sh # 10 minutes

cd $p
git clone https://github.com/Xilinx/embeddedsw
cd embeddedsw
git checkout xilinx-v2018.2
cd lib/sw_apps/zynqmp_fsbl/src
make "BOARD=zcu102" "PROC=a53" "CFLAGS+=-DFSBL_DEBUG_INFO"

build_pmu_firmware.sh # 4 minutes

 

cd $p/embeddedsw/lib/sw_apps/zynqmp_pmufw/src
make

build_atf.sh # 3 minutes

 

cd $p
git clone https://github.com/Xilinx/arm-trusted-firmware.git
cd arm-trusted-firmware
git checkout xilinx-v2018.2
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=aarch64
make DEBUG=0 RESET_TO_BL31=1 PLAT=zynqmp bl31

build_u-boot.sh # 49 minutes - notice that I'm using a parallel make here -

 

cd $p
git clone https://github.com/Xilinx/u-boot-xlnx.git
cd u-boot-xlnx
git checkout xilinx-v2018.2
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=aarch64
make xilinx_zynqmp_zcu102_rev1_0_defconfig
git clone https://git.kernel.org/pub/scm/utils/dtc/dtc.git
cd dtc
make
export PATH=$PATH:$p/dtc
cd $p/u-boot-xlnx
make -j10

build_linux.sh # 3 hours 34 minutes - notice I'm using parallel make here

 

cd $p
git clone https://github.com/Xilinx/linux-xlnx.git
cd linux-xlnx
git checkout xilinx-v2018.2
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
make xilinx_zynqmp_defconfig
make -j10

build_dts.sh # 2 minutes - notice that "hsi" is accepting commands from stdin with bash in-line coding

 

cd $p
cp -p ../zcu102_firstarticle/project-spec/hw-description/system.hdf .

mkdir -p repo/my_dts
cd repo/my_dts
git clone https://github.com/Xilinx/device-tree-xlnx
cd device-tree-xlnx
git checkout xilinx-v2018.2

cd $p
cat > gen_dtb.tcl <<EOF
proc gen_dtb {hdf} {
   open_hw_design \$hdf
   set_repo_path ./repo
   create_sw_design device-tree -os device_tree -proc psu_cortexa53_0
   generate_target -dir my_dts
}
EOF

cat << EOF | hsi
source gen_dtb.tcl
gen_dtb system.hdf
exit
EOF

The "gem3" update is still manual - scripting an append is fraught with peril, so I'll avoid it.

 

compile dtb is a one-liner

create_sd_image.sh # < 1 minute

cd $p
cp -p ../zcu102_firstarticle/pre-built/linux/images/system.bit system.bit

cat > bootgen.bif << EOF
the_ROM_image:
{
[fsbl_config] a53_x64
[bootloader] embeddedsw/lib/sw_apps/zynqmp_fsbl/src/fsbl.elf
[pmufw_image] embeddedsw/lib/sw_apps/zynqmp_pmufw/src/executable.elf
[destination_device=pl] system.bit
[, destination_cpu=a53-0,exception_level=el-3,trustzone] arm-trusted-firmware/build/zynqmp/release/bl31/bl31.elf
[, destination_cpu=a53-0,exception_level=el-2] u-boot-xlnx/u-boot.elf
}
EOF
bootgen -arch zynqmp -image bootgen.bif -o i BOOT.BIN -w on

create_fit_image.sh # < 1 minutes

cd $p
cp -p ../zcu102_firstarticle/pre-built/linux/images/rootfs.cpio.gz petalinux-user-image-plnx_aarch64.cpio.gz

cat > fitImage.its <<EOF
/dts-v1/;
/ {
          description = "U-Boot fitImage for plnx_aarch64 kernel";
          #address-cells = <1>;
          images {
                       kernel@0 {
                                   description = "Linux Kernel";
                                   data = /incbin/("./linux-xlnx/arch/arm64/boot/Image");
                                   type = "kernel";
                                   arch = "arm64";
                                   os = "linux";
                                   compression = "none";
                                   load = <0x80000>;
                                   entry = <0x80000>;
                                   hash@1 {
                                          algo = "sha1";
                                    };
                       };
                       fdt@0 {
                                  description = "Flattened Device Tree blob";
                                  data = /incbin/("./my_dts/system-top.dtb");
                                  type = "flat_dt";
                                  arch = "arm64";
                                  compression = "none";
                                  hash@1 {
                                         algo = "sha1";
                                  };
                      };
                      ramdisk@0 {
                                   description = "ramdisk";
                                   data = /incbin/("./petalinux-user-image-plnx_aarch64.cpio.gz");
                                   type = "ramdisk";
                                   arch = "arm64";
                                   os = "linux";
                                   compression = "none";
                                   hash@1 {
                                          algo = "sha1";
                                   };
                      };
};
      configurations {
             default = "conf@1";
             conf@1 {
                          description = "Boot Linux kernel with FDT blob + ramdisk";
                          kernel = "kernel@0";
                          fdt = "fdt@0";
                          ramdisk = "ramdisk@0";
                          hash@1 {
                                algo = "sha1";
                          };
               };
               conf@2 {
                           description = "Boot Linux kernel with FDT blob";
                           kernel = "kernel@0";
                           fdt = "fdt@0";
                           hash@1 {
                                 algo = "sha1";
                           };
               };
       };
};
EOF

u-boot-xlnx/tools/mkimage -f fitImage.its fitImage.itb

I'm going to keep cutting on this (like to get the SD card to boot all of the way), and I might be posting updates.

I hope this is helpful to somebody.

Note working through these sorts of issues is a good way of understanding how these tools really work, but it takes time and the patience of management (who should have hired somebody who knew what they were doing in the first place)...

 

 

 

1 Solution

Accepted Solutions
Moderator
Moderator
129 Views
Registered: ‎09-12-2007

Re: ZCU102 OSL Flow + 2018.2 (Centos 7.6-1810) on ZCU102 Rev 1.1 and some observations

Jump to solution

You dont need Petalinux to be installed to use this flow. This would defeat the purpose. Yo udo need SDK installed to use HSI/XSCT tools. this is mentioned in the intro.

Looks like someone has made these edits you discussed already.

0 Kudos
3 Replies
Moderator
Moderator
130 Views
Registered: ‎09-12-2007

Re: ZCU102 OSL Flow + 2018.2 (Centos 7.6-1810) on ZCU102 Rev 1.1 and some observations

Jump to solution

You dont need Petalinux to be installed to use this flow. This would defeat the purpose. Yo udo need SDK installed to use HSI/XSCT tools. this is mentioned in the intro.

Looks like someone has made these edits you discussed already.

0 Kudos
Observer redgatorsmp
Observer
113 Views
Registered: ‎07-01-2019

Re: ZCU102 OSL Flow + 2018.2 (Centos 7.6-1810) on ZCU102 Rev 1.1 and some observations

Jump to solution

Well, being a noob, I'm still trying to understand the relationship between these tools. I am an old dog, and these are new tricks.

AFAIK, I would not have the filesystem CPIO image, the .HDF, or the .BIT without the Petalinux BSP. These are not in evidence in what is presented in the "OSL Flow", or suggestions where I get them without building them.

I am gradified that the whole of the "OSL Flow" can be had in about 6 hours, versus 12-18 hours for Petalinux.

I'm still trying to understand why 'OSL Flow' versus Petalinux, aside from Petalinux showing no evidence of working without a person pushing it along.

0 Kudos
Moderator
Moderator
98 Views
Registered: ‎09-12-2007

Re: ZCU102 OSL Flow + 2018.2 (Centos 7.6-1810) on ZCU102 Rev 1.1 and some observations

Jump to solution

You can manually create the rootfs in Linux. Or, you can use the prebuilt images in the wiki here:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/135364615/Zynq+2019.1+Release

There will be an image.ub, this is a FIT image. You can extract the rootfs from here:

dump_image.PNG

 

 

This is also discussed here:

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842374/U-Boot+Images

 

The Petalinux flow is the supported flow. Users can build a linux image in a few commands in Petalinux as apposed to the

many commands in OSL. The OSL flow is just to demo what is going on "under the hood"

0 Kudos