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 hapv_dk
Observer
3,714 Views
Registered: ‎07-17-2017

How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution

Hi Everyone,

I need to port Petalinux to UltraZed board (FPGA: Zynq UltraScale+MPSoC XCZU3EG-1SFVA625  and Flash: Dual Parallel (x8) QSPI Flash MicronMT25QU256ABAIEW7-0SIT). Here is my configuration:

#
# Flash Settings
#

Screenshot_20171105_223946.png
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_SELECT=y
# CONFIG_SUBSYSTEM_FLASH_MANUAL_SELECT is not set
# CONFIG_SUBSYSTEM_FLASH__ADVANCED_AUTOCONFIG is not set

#
# partition 0
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_NAME="boot"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART0_SIZE=0x1000000

#
# partition 1
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_NAME="bootenv"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART1_SIZE=0x40000

#
# partition 2
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_NAME="kernel"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART2_SIZE=0x1600000

#
# partition 3
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_NAME="jffs2"
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART3_SIZE=0x1600000

#
# partition 4
#
CONFIG_SUBSYSTEM_FLASH_PSU_QSPI_0_BANKLESS_PART4_NAME=""
CONFIG_SUBSYSTEM_FLASH_IP_NAME="psu_qspi_0"

 

#
# boot image settings
#

Screenshot_20171105_224024.png
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_FLASH_SELECT=y
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_SD_SELECT is not set
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_MEDIA_MANUAL_SELECT is not set
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_PART_NAME="boot"
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOT_IMAGE_NAME="BOOT.BIN"

#
# u-boot env partition settings
#
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_FLASH_SELECT=y
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_MEDIA_MANUAL_SELECT is not set
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_BOOTENV_PART_NAME="bootenv"

#
# kernel image settings
#
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_FLASH_SELECT=y
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_SD_SELECT is not set
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_ETHERNET_SELECT is not set
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_MEDIA_MANUAL_SELECT is not set
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_PART_NAME="kernel"
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_KERNEL_IMAGE_NAME="image.ub"

#
# jffs2 rootfs image settings
#
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_FLASH_SELECT=y
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_MEDIA_MANUAL_SELECT is not set
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_PART_NAME="jffs2"
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_JFFS2_IMAGE_NAME="rootfs.jffs2"

#
# dtb image settings
#
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_BOOTIMAGE_SELECT=y
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_FLASH_SELECT is not set
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_SD_SELECT is not set
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_ETHERNET_SELECT is not set
# CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_MEDIA_MANUAL_SELECT is not set
CONFIG_SUBSYSTEM_IMAGES_ADVANCED_AUTOCONFIG_DTB_IMAGE_NAME="system.dtb"
CONFIG_SUBSYSTEM_ENDIAN_LITTLE=y

 

#
# Image Packaging Configuration
#

Screenshot_20171105_224045.png
# CONFIG_SUBSYSTEM_ROOTFS_INITRAMFS is not set
# CONFIG_SUBSYSTEM_ROOTFS_INITRD is not set
CONFIG_SUBSYSTEM_ROOTFS_JFFS2=y
# CONFIG_SUBSYSTEM_ROOTFS_NFS is not set
# CONFIG_SUBSYSTEM_ROOTFS_SD is not set
# CONFIG_SUBSYSTEM_ROOTFS_OTHER is not set
# CONFIG_SUBSYSTEM_JFFS2_ERASE_SIZE_16 is not set
# CONFIG_SUBSYSTEM_JFFS2_ERASE_SIZE_32 is not set
# CONFIG_SUBSYSTEM_JFFS2_ERASE_SIZE_64 is not set
CONFIG_SUBSYSTEM_JFFS2_ERASE_SIZE_128=y
# CONFIG_SUBSYSTEM_JFFS2_ERASE_SIZE_256 is not set
# CONFIG_SUBSYSTEM_JFFS2_ERASE_SIZE_512 is not set
CONFIG_SUBSYSTEM_UIMAGE_NAME="image.ub"
CONFIG_SUBSYSTEM_DTB_PADDING_SIZE=0x1000
CONFIG_SUBSYSTEM_COPY_TO_TFTPBOOT=y
CONFIG_SUBSYSTEM_TFTPBOOT_DIR="/tftpboot"

 

 

But rootfs.jffsw isn't created after runcommand "petalinux-build" and FITIMAGE_ROOTFS_TYPE still is "cpio.gz" in file fit-image.conf . Here is my output files:

 

Screenshot_20171105_222222.png

Please tell my if you have any hint,

Pham Van Ha

 

P/s: my full configuration files is attached below this port

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
4,703 Views
Registered: ‎04-24-2017

Re: How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution

Hi @hapv_dk,

 

I have updated the comments please check.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------

View solution in original post

0 Kudos
5 Replies
Moderator
Moderator
3,562 Views
Registered: ‎04-24-2017

Re: How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution

Hi @hapv_dk

 

 

A jffs2 filesystem image can be created using mtd utilities, which can be then flashed to the desired mtd partition (mtd3 in our case). While creating jffs2 image, make sure to pass correct eraseblock size (can be found by sf probe 0 0 0 command on u-boot prompt).

 

Note: Attached my config for reference.

 

Generating jffs2 image

In yocto or Petalinux project you can specify following two parameters in the local.conf or <plnx-proj-root>/project-spec/meta-user/conf/petalinuxbsp.conf

 

IMAGE_FSTYPES_append = " jffs2"

JFFS2_ERASEBLOCK = "0x2000"

 

This will generate petalinux-user-image-plnx_aarch64.jffs2 file in the deploy directory. But the images will not be copied into <plnx-proj-root>/images/linux directory and this is fixed in 2017.3

 

In Petalinux this can be specified in the “Image Packaging Configuration” of petalinux-config command:

  • Select Root file system type as jffs2
  • JFFS2-selection.png
  • Select appropriate erase block size
  • This will generate rootfs.jffs2 file image/linux directory.

 

Separately if you have tar.gz or rootfs directory, you can generate the rootfs image on the host machine by following command

mkfs.jffs2 --root=<rootfs directory location> --eraseblock=<erase block size> -p -o rootfs.jffs2

 

 

 

Flashing jffs2 image on the partition

It is possible to flash the generated image from u-boot as well as from the Linux prompt.

It is necessary to clean /erase the flash before writing new data (though Linux will take care).

  • From Linux prompt:
    1. Erase the entire partition and also format it to jffs2

# flash_eraseall -j /dev/mtd3

  1. Write the jffs2 image on mtd 3 partition

# flashcp <path to rootfs.jffs2> /dev/mtd3

 

  • From u-boot prompt
    1. Probe the flash device

> sf probe 0 0 0

  1. Erase the entire partition (here you need to know the offset and size)

> sf erase 0x1300000 0x4000000

  1. Load the jffs2 image in the memory location (ddr) from sd card (other tftp from network)

> fatload mmc 0 0x10000000 rootfs.jffs2

  1. Write the image from the memory on to the flash

> sf write 0x10000000 0x1300000 ${filesize}

 

  • From Linux prompt with tar.gz image (not jffs2)

Rootfs content can be simply copied after mounting jffs2 partition

  1. Erase the entire partition and also format it to jffs2 (mandatory)

# flash_eraseall -j /dev/mtd3

  1. Determine the location of rootfs.tar.gz image (can be on sd card or network. Assuming sd card for now)
    1. Mount the sd card

#  mount /dev/mmcblk0p1 /media

  1. Mount jffs2 partition on the /mnt

# mount -t  jffs2 /dev/mtdblock3 /mnt

  1. Copy the file system to the jffs2 partition

# cd /mnt/

# tar zxvf /media/rootfs.tar.gz (choose appropriate path here).

 

 

 

Setting kernel rootfs

 

One can use rootfs from the jffs2 partition regardless of the boot-mode. Rootfs path can be specified to kernel through bootargs. One can change the bootargs from the u-boot prompt.

For sd-boot, the the bootargs for the root partition is set by sdroot0 variable. You can change the sdroot0 variable to add following to the bootargs

root=/dev/mtdblock3 rw rootwait rootfstype=jffs2

u-boot> setenv sdroot0 "setenv bootargs earlycon clk_ignore_unused root=/dev/mtdblock3 rw rootwait rootfstype=jffs2"

u-boot> saveenv  # for next boot

u-boot> run sdboot

 

Similarly for other bootmodes make sure that the bootargs is set properly.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
Observer hapv_dk
Observer
3,612 Views
Registered: ‎07-17-2017

Re: How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution

Hi @sandeepg,

Thanks for your hints. But you can see that: In my post,  I had done steps in Petalinux as what you said and Petalinux hadn't generated rootfs.jffs2 file image/linux directory.

 

I have tried modifying  local.config in Yocto project, Petalinux run do_image_jffs2. But after that it run do_image_cpio and  rootfs.jffs2 file hadn't been created  in image/linux directory. Here is my task log:

 

do_populate_lic (18477): log.do_populate_lic.18477
do_rootfs (22969): log.do_rootfs.22969
do_image (31137): log.do_image.31137
do_image_cpio (31139): log.do_image_cpio.31139
do_image_debugfs_cpio (31141): log.do_image_debugfs_cpio.31141
do_image_debugfs_jffs2 (31142): log.do_image_debugfs_jffs2.31142
do_image_jffs2 (31143): log.do_image_jffs2.31143
do_image_complete (31187): log.do_image_complete.31187
do_image_qa (31214): log.do_image_qa.31214
do_rm_work (31215): log.do_rm_work.31215
do_rm_work_all (31265): log.do_rm_work_all.31265
do_rootfs (31940): log.do_rootfs.31940
do_image (7789): log.do_image.7789
do_image_cpio (7791): log.do_image_cpio.7791
do_image_debugfs_cpio (7792): log.do_image_debugfs_cpio.7792
do_image_xilinx_fitimage (7819): log.do_image_xilinx_fitimage.7819
do_image_debugfs_xilinx_fitimage (8068): log.do_image_debugfs_xilinx_fitimage.8068
do_image_complete (8305): log.do_image_complete.8305
do_image_qa (8332): log.do_image_qa.8332
do_rm_work (8333): log.do_rm_work.8333
do_rm_work_all (8388): log.do_rm_work_all.8388

 

 

Please support me to fix this bug,

Best regards,

Pham Van Ha

0 Kudos
Moderator
Moderator
4,704 Views
Registered: ‎04-24-2017

Re: How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution

Hi @hapv_dk,

 

I have updated the comments please check.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------

View solution in original post

0 Kudos
Observer hapv_dk
Observer
3,544 Views
Registered: ‎07-17-2017

Re: How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution
Thank alot @sandeepg,
I will try again.
0 Kudos
Moderator
Moderator
3,459 Views
Registered: ‎04-24-2017

Re: How to create JFFS2 in Petalinux 2017.1 or 2017.2 for ZynqMP

Jump to solution

Hi @hapv_dk,

 

For some reason I was not able to see my post so posting again.

 

In Yocto or PetaLinux project you can specify following two parameters in the local.conf or <plnx-proj-root>/project-spec/meta-user/conf/petalinuxbsp.conf

 

IMAGE_FSTYPES_append = " jffs2"

JFFS2_ERASEBLOCK = "0x2000"

 

This will generate <image name>.jffs2 file in the build/tmp/deploy/images area.

 

Note: This images will not be copied to <plnx-proj-root>/images/linux directory and this is fixed in 2017.3 release.

 

Attached my config for reference.

 

In Petalinux this can be specified in the “Image Packaging Configuration” of petalinux-config command:

  • Select Root file system type as jffs2
  • jffs2.PNG
  • Select appropriate erase block size
  • This will generate rootfs.jffs2 file image/linux directory.

 

Separately if you have tar.gz or rootfs directory, you can generate the rootfs image on the host machine by following command

mkfs.jffs2 --root=<rootfs directory location> --eraseblock=<erase block size> -p -o rootfs.jffs2

 

 

 

Flashing jffs2 image on the partition

It is possible to flash the generated image from u-boot as well as from the Linux prompt.

It is necessary to clean /erase the flash before writing new data (though Linux will take care).

  • From Linux prompt:
    1. Erase the entire partition and also format it to jffs2

# flash_eraseall -j /dev/mtd3

  1. Write the jffs2 image on mtd 3 partition

# flashcp <path to rootfs.jffs2> /dev/mtd3

 

  • From u-boot prompt
    1. Probe the flash device

> sf probe 0 0 0

  1. Erase the entire partition (here you need to know the offset and size)

> sf erase 0x1300000 0x4000000

  1. Load the jffs2 image in the memory location (ddr) from sd card (other tftp from network)

> fatload mmc 0 0x10000000 rootfs.jffs2

  1. Write the image from the memory on to the flash

> sf write 0x10000000 0x1300000 ${filesize}

 

  • From Linux prompt with tar.gz image (not jffs2)

Rootfs content can be simply copied after mounting jffs2 partition

  1. Erase the entire partition and also format it to jffs2 (mandatory)

# flash_eraseall -j /dev/mtd3

  1. Determine the location of rootfs.tar.gz image (can be on sd card or network. Assuming sd card for now)
    1. Mount the sd card

#  mount /dev/mmcblk0p1 /media

  1. Mount jffs2 partition on the /mnt

# mount -t  jffs2 /dev/mtdblock3 /mnt

  1. Copy the file system to the jffs2 partition

# cd /mnt/

# tar zxvf /media/rootfs.tar.gz (choose appropriate path here).

 

 

 

Setting kernel rootfs

 

One can use rootfs from the jffs2 partition regardless of the boot-mode. Rootfs path can be specified to kernel through bootargs. One can change the bootargs from the u-boot prompt.

For sd-boot, the the bootargs for the root partition is set by sdroot0 variable. You can change the sdroot0 variable to add following to the bootargs

root=/dev/mtdblock3 rw rootwait rootfstype=jffs2

u-boot> setenv sdroot0 "setenv bootargs earlycon clk_ignore_unused root=/dev/mtdblock3 rw rootwait rootfstype=jffs2"

u-boot> saveenv  # for next boot

u-boot> run sdboot

 

Similarly for other bootmodes make sure that the bootargs is set properly.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos