Polarfire-soc-buildroot-sdk with HSS

Hello,

Please let me clarify how to use polarfire-soc-buildroot-sdk (commit 6514a11) with the latest HSS booting from SD card.

So far, I installed the HSS, which was prepared as “Default/hss.elf” of HSS GitHub repo (release 2020.10), to eNVM by SoftConsole-v6.4/extras/mpfs/mpfs-program-bootmode.sh.

P.S. I wrote there was Default/hss.elf in the HSS distribution, but it wasn’t correct. I guess I built it by myself. Sorry.

And regarding FlashPro programming, I chose Icicle-Kit-sdcard-2020.10-HSS_0_99_13.zip mentioned in this page.

By flashing Linux image which is also mentioned in the web page above (I believe this is built by OpenEmbedded/Yocto), I confirmed that Linux booted fine.

So now, I’m finally trying to evaluate Buildroot procedure.

After reading through polarfire-soc-buildroot-sdk document and Makefile, I found the following three make targets.

  • format-icicle-emmc-image
  • format-icicle-sd-image
  • format-boot-loader

In either case, rootfs won’t look copied to SD card. I also found target “format-rootfs-image” and found it is dd’ing rootfs.bin to $(PART3).

However, for the target “format-boot-loader”, $(PART3) is for opensbi. For the target “format-icicle-sd-image”, ext4 partition is used to store $(fit) and $(uboot_s_scr), instead of vfat partition.

After all, my questions are, if we use HSS and booting from SD-card,

  • What kind of GPT partitions are required? (HSS payload, vfat and ext4?)
  • Can we place $(fit), $(uboot_s_scr) and rootfs in the same ext4 partition?
  • Do we still need $(fsbl) and $(opensbi) even using HSS?

Thank you for your suggestion.

Regards,
Atsushi Yokoyama

Hi @yokoyama-flogics :slight_smile:

Theres a few things to this question so I’ll try and break it down:

For your HSS build, make sure to use the def_config.sdcard configuration from the boards/icicle-kit-es folder, you will also need to update to the SD Card XML which is available from the Icicle Kit Reference design repository on GitHub.

To build and write an image to an SD card you can run the following commands:

make clean && make DEVKIT=icicle-kit-es-sd
sudo make DISK=/dev/sdX DEVKIT=icicle-kit-es-sd format-icicle-image
sudo make DISK=/dev/sdX DEVKIT=icicle-kit-es-sd format-rootfs-image

where /dev/sdX is your SD card.

Once Linux has booted to mount and switch to the rootfs run the following:
mount /dev/mmcblk0p3 /mnt
chroot /mnt

"What kind of GPT partitions are required? (HSS payload, vfat and ext4?)"
For the partition types, in the Makefile you can see the partition types used on lines 501 - 503:
–new=1:2048:3248 --change-name=1:uboot --typecode=1:21686148-6449-6E6F-744E-656564454649
–new=2:4096:88063 --change-name=2:kernel --typecode=2:0FC63DAF-8483-4772-8E79-3D69D8477DE4
–new=3:88064:${ROOT_SIZE} --change-name=3:root --typecode=2:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \

Partition 1 uboot has a specific type code so it can be identified by the HSS as the payload.

Can we place $(fit) , $(uboot_s_scr) and rootfs in the same ext4 partition?
Technically you could but this would complicate the mounting of rootfs and its not something we’d advise doing

Do we still need $(fsbl) and $(opensbi) even using HSS?
No you don’t need these - they’re used in the Aloe kits but when you specify the Icicle kit they won’t be built. From lines 14 - 23 of the make file:
ifeq “(DEVKIT)" "icicle-kit-es" HSS_SUPPORT ?= y HSS_TARGET ?= icicle-kit-es else ifeq "(DEVKIT)” “icicle-kit-es-sd”
HSS_SUPPORT ?= y
HSS_TARGET ?= icicle-kit-es
else
FSBL_SUPPORT ?= y
OSBI_SUPPORT ?= y
endif

1 Like

Hello @hugh.breslin,

Thank you for clarification.

Now I understand how to use the Makefile, disk partition requirements, and polarfire-soc-buildroot-sdk boot procedure.

@hugh.breslin wrote:
For your HSS build, make sure to use the def_config.sdcard configuration from the boards/icicle-kit-es folder, you will also need to update to the SD Card XML which is available from the Icicle Kit Reference design repository on GitHub.

Yes, I adopted boards/icicle-kit-es/def_config.sdcard for HSS build.
I also used the XML file located at https://github.com/polarfire-soc/icicle-kit-reference-design/blob/master/XML/ICICLE_MSS_SD_cfg.xml to regenerate soc_config.

And I executed the following commands.
Changed slightly for the correct target names.
And also, directly ran dd because make complained that $(PART3) was not defined for the target format-rootfs-image, to my understanding.

$ make clean && make DEVKIT=icicle-kit-es-sd
$ sudo make DISK=/dev/sdX DEVKIT=icicle-kit-es-sd format-icicle-sd-image
$ sudo dd if=work/rootfs.bin of=/dev/sdX3 bs=4096

Regarding the required partitions, now I understood that U-Boot can also recognize ext4, so we no more require vfat partition. (It looks different from the meta-polarfire-soc-yocto-bsp case, so I was confused… Thanks!)

Finally, I understood we should have the following partitions for polarfire-soc-buildroot-sdk.

  • sdX1 (uboot) as BIOS boot partition: should contain HSS payload.
  • sdX2 (kernel) as Linux ext4: should contain fitImage.fit and uEnv_s-mode.txt. U-Boot refers these.
  • sdX3 (root) as also Linux ext4: should contain rootfs.

I also understood how Makefile variables HSS_SUPPORT, FSBL_SUPPORT etc. work.
Thank you for your explanation.

Now I could successfully boot the buildroot version of Linux, mount rootfs, and chroot on it.

(snip)
Starting dropbear sshd: [   12.227288] random: dropbear: uninitialized urandom read (32 bytes read)
OK

Welcome to Buildroot
buildroot login: root
Password: 
# uname -a
Linux buildroot 5.6.16 #1 SMP Wed Nov 11 11:34:08 JST 2020 riscv64 GNU/Linux
# 

Thanks and Regards,
Atsushi

1 Like