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 riccardo.brue
Observer
778 Views
Registered: ‎03-02-2019

Using JFFS2 on QSPI

First of all I am relatevely new on the Linux kernel world, so I would appreaciate if you will be detailed on the answers.

I have successfully managed to boot PetaLinux (with custom applications in C) on a ZedBoard using the QSPI.

Now I have the requirement to make some Linux settings persistent (such as setting a static IP address, storing small configuration files useful for the previous applications, etc) in such way that when the board is rebooted, these configurations won't be discarded.

Moreover I cannot use the SD card, so I am forced to use the built-in QSPI memory.

I had a little research and I have found that probably I have to use a JFFS2 file system but I don't understand how to "include" this on the QSPI. I mean, what I have done so far (without JFFS2) was:

1. From petalinux-config

  • Subsystem AUTO Hardware Settings > Advanced bootable images storage Settings
  • boot image settings > image storage media > select "primary flash"
  • u-boot env partition settings > image storage media > select "primary flash"
  • kernel image settings > image storage media > select "primary flash"
  • jffs2 rootfs image settings > image storage media > select "primary flash"
  • dtb image settings > image storage media > select "from boot image"

2. Create a BOOT.bin file using the following command: petalinux-package --boot --format BIN --force --u-boot --kernel

3. From Vivavo SDK > Xilinx > Program Flash: I have selected the original Vivado hardware design, as image file I have selected the BOOT.bin generated by PetaLinux and as FSBL file I have used the one generated by PetaLinux (zynq_fsbl.elf)

4. Program the QSPI flash memory and all works.

Now, in order to enable JFFS2 support, I have done the following changes with petalinux-config:

  • Image Packaging Configuration > Root file system type > jffs2
  • Erase block size (8KiB)
  • petalinux-build

I can see that there is the "rootfs.jffs2" file in the ./images/linux path, but how should I use that? How I should include that on the BOOT.bin? Is the flashing step that I was doing right? (It seems to work by the way).

0 Kudos
11 Replies
Observer riccardo.brue
Observer
777 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

I forgot to mention that I am building the PetaLinux image from a different computer (Ubuntu 16.04 on virtual machine) than the one which I use to run Vivado SDK (WIndows 10 based) I am just copying the generated files in order to flash them in the ZedBoard.
0 Kudos
Observer riccardo.brue
Observer
800 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

Another thing is that if I generate the BOOT.bin and flash it using the same (previous) procedure, I obtain the following kernel panic on the ZedBoard:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
0 Kudos
Moderator
Moderator
774 Views
Registered: ‎08-10-2007

Re: Using JFFS2 on QSPI

Could the following Answer Record help address the errors you are seeing: https://www.xilinx.com/support/answers/71114.html

-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
Observer riccardo.brue
Observer
752 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

I think that it is not the solution. More than the kernel panic that I am receiving, I am concerned about how to create a "permanent" filesystem on the QSPI. I have tried to understand the UG1144 at page 61/62 (Configuring JFFS2 Boot) thinking that it could bring me to a solution, but I don't understand how to do those steps (Steps to Configure JFFS2 Boot, step 6). How am I supposed to handle the rootfs.jffs2 file?
0 Kudos
Observer riccardo.brue
Observer
736 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

Today I tried to do this:
Booted the board form the SD where there are the following files:

  • BOOT.bin
  • image.ub
  • rootfs.jffs2

When the countdown is shown, i press enter to show the "Zynq" shell (it should be the u-boot inside the BOOT.bin right?).

Now I have executed the following commands in order to write the content of the SD card inside the QSPI:

  1. sf probe 0 0 0
  2. sf erase 0 0x2000000
  3. fatload mmc 0 0x5000000 BOOT.BIN
  4. sf write 0x08000000 0 ${filesize}
  5. fatload mmc 0 0x5000000 image.ub
  6. sf write 0x08000000 0x00520000 ${filesize}
  7. fatload mmc 0 0x5000000 rootfs.jffs2
  8. sf write 0x08000000 0x00fa0000 ${filesize}

No errors are shown when I execute the commands, but when I switch off the board, put the jumpers in QSPI boot mode, and rebooted the board, nothing is shown. i think that maybe I am writing on wrong addresses.

This is the generated system-conf.dtsi where I have taken the offsets:

&qspi {
	#address-cells = <1>;
	#size-cells = <0>;
	flash0: flash@0 {
		compatible = "n25q512a","micron,m25p80";
		reg = <0x0>;
		#address-cells = <1>;
		#size-cells = <1>;
		spi-max-frequency = <50000000>;
		partition@0x00000000 {
			label = "boot";
			reg = <0x00000000 0x00500000>;
		};
		partition@0x00500000 {
			label = "bootenv";
			reg = <0x00500000 0x00020000>;
		};
		partition@0x00520000 {
			label = "kernel";
			reg = <0x00520000 0x00a80000>;
		};
		partition@0x00fa0000 {
			label = "spare";
			reg = <0x00fa0000 0x00000000>;
		};
	};
};

What am I missing to do ?

0 Kudos
Observer riccardo.brue
Observer
645 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

UP
0 Kudos
Visitor kautschuk
Visitor
632 Views
Registered: ‎03-29-2018

Re: Using JFFS2 on QSPI

Do you need to mount the rootfs RW?

If this is not a requirement you could use an initramfs and combine that into image.ub

0 Kudos
Visitor kautschuk
Visitor
631 Views
Registered: ‎03-29-2018

Re: Using JFFS2 on QSPI

I mean if it is just a few configuration files that you need to read on boot you could add a partition on the QSPI -> boot your initramfs which resides in image.ub -> mount said partition from QSPI -> read/write config-files from there

0 Kudos
Observer riccardo.brue
Observer
596 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

No solution yet, I need to have te possibility to store files runtime, without using an external SD card. 

0 Kudos
Observer riccardo.brue
Observer
593 Views
Registered: ‎03-02-2019

Re: Using JFFS2 on QSPI

Hi kautschuk. Your solution sounds interesting, can you provide a guide/tutorial or address me to the right documentation in order to create a second partition on the QSPI ? So far I just know how to flash the entire partition using Vivado tools and both the BOOT.bin and zynq_fsbl.elf files. Thank you for your reply.

0 Kudos
Moderator
Moderator
568 Views
Registered: ‎06-27-2017

Re: Using JFFS2 on QSPI

Hi @riccardo.brue ,

You can use below command to include rootfs.jffs2


petalinux-package --boot --u-boot --kernel image.ub --add rootfs.jffs2 --offset <jffs2 filesystem offset> --force

then program the image.ub to kernel partition(flash)

or

you can write the rootfs.jffs2 content in 0xfa00000 which you have already done. You need to rename the "spare" partition to "jffs2" because bootarguments will check for jffs2 as a root name.

If you still observe the mount failure then please share the complete boot log

Best Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.
0 Kudos