yocto wic image generation for rz/g2ul board

Hello Expert,

In yocto build of Renesas RZ/G2UL, it generates "tar.gz" image along with the bootloader and kernel images.

After that, we need to follow manual steps to partition the SD card and put the kernel and rootfs in seperate partition along with the DD of the bootloaders on initial sectors of SD card.

# sudo dd if=/dev/zero of=/dev/sda bs=1M status=progress

# ./usb_sd_partition.sh

# sudo dd if=bootparams-smarc-rzg2ul.bin of=/dev/sda seek=1 count=1
# sudo dd if=bl2-smarc-rzg2ul.bin of=/dev/sda seek=8
# sudo dd if=fip-smarc-rzg2ul.bin of=/dev/sda seek=128

# sudo cp Image-r9a07g043u11-smarc.dtb /media/embedded/RZ_FAT/
# sudo cp <Image>.bin /media/embedded/RZ_FAT/

# cd /media/embedded/RZ_ext/
# sudo tar jxvf <IMAGE>.tar.bz2

To avoid this manual process and do all the above processes in single common steps with command like "DD" (common way of other processor like NXP, TI ) way, do we have any WIC image generation WKS file?

How we can automate this process? (especially flash and prepare SD Card in Windows machine as well - with single wic or image file we can achieve that through different flash writer utility in Windows.) 


A fast response would be appreciated.

Thanks and Regards,

Anil Patel

Parents Reply Children
  • Hello HungT,

    Script file with listed command will not work on windows system.

    For windows, wic image is suitable and expected behavior.

    Is there any specific reason why we don't follow the standard yocto way for creating single file (like wic) and flash sd card and instead go with this manual process?

    Thanks,

    Anil

  • Hmmm, are you building the BSP with a Linux machine anyway?

  • This script will make an SD Card image file (like wic) that can be programmed by a Windows PC user.

    https://github.com/renesas-rz/rzg2_bsp_scripts/tree/master/image_creator

  • Hi,

    As the create_image.sh script in Chris's answer does,

    • By using a regular file instead of the special file (/dev/sda), you can create a WIC-like image file you need.
    • Like a SD card, a regular file can have multiple partitions, and each partition can be mounted using the loop device.

    In your case, it seems that you are writing bootparams, BR2, and FIP to an unused area (?) right after the master boot record, so I think it would be faster to change your script than to change the create_image.sh script.

    BR

  • Thank you all for the response. I came to know that there is not wic file or wks rules for renesas yocto.

    Can anyone please answer :

    • Is there any specific reason why we don't follow the standard Yocto way for creating single files (like wic) and flash sd card and instead go with this manual process?
    • When we expect to have support of WIC image?
    • Is U-Boot built correctly inside yocto? or it has to built outside of yocto (RZ/G2 Uboot and Trusted Firmware and creae srec and mot file) and flash? (Like a mention in my steps)

    Thanks,

    Anil

  • When we expect to have support of WIC image?

    WIC will be added from BSP v3.0.5

    Is U-Boot built correctly inside yocto? or it has to built outside of yocto (RZ/G2 Uboot and Trusted Firmware and creae srec and mot file) and flash? (Like a mention in my steps)

    u-boot is built inside of Yocto, then packaged together with Trusted Firmware-A. The "FIP" image that you program contains u-boot.

  • Hi,

    Anil said:
    Is there any specific reason why we don't follow the standard Yocto way for creating single files (like wic) and flash sd card and instead go with this manual process?

    This is my personal guess.

    I think creating a WIC file is not very important for this device/board, so it is put on the back burner.

    RZ/G2UL is designed to boot from eSD, eMMC, and quad SPI flash memory.
    The SMARC RZ/G2UL board includes all of these boot devices and we can try them out.
    However, I believe that, perhaps due to footprint, the eSD is replaced by an SD card holder that can also be used as external storage.

    We can write the WIC file to the SD card using a utility on the host machine, but not to the blank eSD on the board. Also, in the case of a custom board equipped with RZ/G2UL, there may not be an eSD-compatible SD card holder.

    BR

  • Let me ask a few questions about image_creator.

    1. U-boot can load the kernel and device tree from an ext4 partition.
      Also, I don't think SMARC RZ/G2UL board and the software support anything that requires a FAT partition (e.g. UEFI).
      Why does it create a multi-partition image with a FAT partition?

    2. SMARC RZ/G2UL board comes with an eSD-compatible SD card holder.
      Why doesn't it make a WIC-like file bootable by copying the bootloader?

    BR

  • U-boot can load the kernel and device tree from an ext4 partition.
    Also, I don't think SMARC RZ/G2UL board and the software support anything that requires a FAT partition (e.g. UEFI).
    Why does it create a multi-partition image with a FAT partition?

    The FAT partition is just to match the Renesas documentation and default boot commands of the Renesas Evaluation Boards. The FAT partition is helpful for people to add files that do not have a Linux PC.

    The FAT partition is not required. I see many RZ products not include the FAT partition. They keep the files in /boot/ in ext4.

    The image_creator script was created to make SD Card images to give to Renesas Sales people to program demos images into SD Cards using a Windows PC. But, it can be modified to however you want it. The important part is showing out to use loop mounts.

  • I got it. Thanks for the detailed explanation.