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: 
Visitor bog_dan
Visitor
2,274 Views
Registered: ‎02-21-2018

Modifying filesystem Petalinux

Hi everyone,

 

I have an issue with my petalinux boot where any changes I make are lost upon system power down. I looked around and found it is because of the filesystem I'm using. My boot image that works uses the default (Initramfs). I am trying to switch to jffs2 but am running into issues. I modified the configuration settings to use jffs2 instead of the initramfs, the built and packaged a boot.bin image normally. There is a rootfs.jffs2 file in my project /images/linux/ directory. The system boots unsuccesfully with the following message:

 

MTD: MTD device with name "jffs2" not found.
VFS: Cannot open root device "mtd:jffs2" or unknown-block(0,0): error -2
Please append a correct "root=" boot option; here are the available partitions:
0100 16384 ram0 (driver?)
0101 16384 ram1 (driver?)
0102 16384 ram2 (driver?)
0103 16384 ram3 (driver?)
0104 16384 ram4 (driver?)
0105 16384 ram5 (driver?)
0106 16384 ram6 (driver?)
0107 16384 ram7 (driver?)
0108 16384 ram8 (driver?)
0109 16384 ram9 (driver?)
010a 16384 ram10 (driver?)
010b 16384 ram11 (driver?)
010c 16384 ram12 (driver?)
010d 16384 ram13 (driver?)
010e 16384 ram14 (driver?)
010f 16384 ram15 (driver?)
1f00 5120 mtdblock0 (driver?)
1f01 128 mtdblock1 (driver?)
1f02 10752 mtdblock2 (driver?)
1f03 16768 mtdblock3 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU0: stopping

I'm not sure what other changes I need to make to make it boot with a jffs2 filesystem. If it makes any difference, I am using release 2017.4 of petalinux and am trying to boot from qspi flash. If anyone has any knowledge on how to make this work please let me know. Thanks.

0 Kudos
7 Replies
2,217 Views
Registered: ‎04-20-2017

Re: Modifying filesystem Petalinux

The easiest way is to use a persistent rootfs on a SD card or on emmc.
To have everything on Flash, the board you are using must have sufficient flash memory and it should be possible to have a persistent file system on flash. If it makes sense is a different question...
Have you made the necessary settings in petalinux-config? Did you activate jffs support in petalinux-config - c kernel?

0 Kudos
Moderator
Moderator
2,186 Views
Registered: ‎06-27-2017

Re: Modifying filesystem Petalinux

Hi @bog_dan,

 

This error mostly due to the rootfs partition is not detected/avaialble in the flash.

Can you check in device tree for the "rootfs" partition is available or not? if yes then you should program the rootfs.jffs2 should be available in that offset.

Please share the complete log to check whether flash part detected or not.

 

Thanks

Kranthi

--------------------------
Don't forget to reply, kudo, and accept as solution.

Best Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.
0 Kudos
Visitor bog_dan
Visitor
2,151 Views
Registered: ‎02-21-2018

Re: Modifying filesystem Petalinux

juergen.kratochwill@grapho-metronic.com

 

The kernel configuration is the only thing I changed in the process of creating a boot image. Unfortunately I don't have any storage memory on the board aside the the boot flash.

 

@gudishak

I have not added a dedicated partition for the jffs2 sytem, definitely an issue. Assuming I add a partition with a large enough size to accommodate it, is it possible to package it into the boot.bin image somehow? Most of the guides I've found talk about using ethernet or an SD card, neither of which I have available on the board. I'm confused about the log you'd like to see. 

0 Kudos
Moderator
Moderator
2,140 Views
Registered: ‎06-27-2017

Re: Modifying filesystem Petalinux

Hi @bog_dan,

 

After changing your filesystem type in petalinux configuration you have to do below changes so that jffs2 filesystem will picked while mounting.

 

1.petalinux-config

    a. set below settings in the menuconfig

        Image Packaging Configuration

                 Root filesystem type (JFFS2)

        Subsystem AUTO Hardware Settings

                   Flash Settings

         adjust boot partitions so that all partitions fit into them.For example for default rootfs content for zcu102 see that below:

         Subsystem AUTO Hardware Settings

                flash settings--->

                 Advanced flash auto configuration --> [create new patition with jffs2 & mention the size of rootfs.jffs2]

              [*]   Advanced bootable images storage Settings

                            boot image settings

                                             image storage media (primary flash) 

                            kernel image settings

                                               image storage media (primary flash)

                           dtb image settings

                                              from boot image

 

                                              

3. petalinux-build

4. petalinux-package --boot --u-boot --kernel --add images/linux/rootfs.jffs2 --offset <partition offset given for jffs2>

Now your system will boot with mounting JFFS2 filesystem runtime.

 

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

Best Regards
Kranthi
--------------------------
Don't forget to reply, kudo, and accept as solution.
2,118 Views
Registered: ‎04-20-2017

Re: Modifying filesystem Petalinux

@bog_dan, Also beware that flash chips are not made for excessive writing. The wear leveling is also very limited. Take note of that in your architecture (deactivate logging etc) , otherwise your file systems starts be corrupted fairly quickly in a production system relying on persistent flash for writes
0 Kudos
Visitor bog_dan
Visitor
2,094 Views
Registered: ‎02-21-2018

Re: Modifying filesystem Petalinux

Hi @gudishak

 

I added a partition for the jffs2 filesystem but am having some issues. Here is my device tree:

 

/*
 * CAUTION: This file is automatically generated by PetaLinux SDK.
 * DO NOT modify this file
 */


/ {
	chosen {
		bootargs = "console=ttyPS0,115200 earlyprintk root=mtd:jffs2 rw rootfstype=jffs2";
		stdout-path = "serial0:115200n8";
	};
};

&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 = "jffs2";
			reg = <0x00fa0000 0x00800000>;
		};
	};
};

I ran this command to build my petalinux image : "petalinux-package --boot --fsbl ./images/linux/zynq_fsbl.elf --fpga CCA_1K_top_3XX-0300-0010-FROM-PCI-INT-LEVEL.bit --u-boot --kernel --add ./images/linux/rootfs.jffs2 --offset 0x00fa0000 --force"

 

This is the error I am getting:

jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab000: 0x5d69 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab004: 0x78b4 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab008: 0x1e47 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab00c: 0xb5d3 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab010: 0x256a instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab014: 0x1a48 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab018: 0x3962 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab01c: 0x3a4b instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab020: 0xc500 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ab024: 0xe6f3 instead
jffs2: Further such events for this erase block will not be printed
jffs2: Node at 0x006abfe4 with length 0x0000002c would run over the end of the erase block
jffs2: Perhaps the file system was created with the wrong erase size?
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ac000: 0x0404 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ac004: 0xc596 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ac008: 0xf0ef instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x006ac00c: 0x7261 instead
VFS: Mounted root (jffs2 filesystem) on device 31:3.
devtmpfs: mounted
Freeing unused kernel memory: 1024K (c0900000 - c0a00000)
Starting init: /sbin/init exists but couldn't execute it (error -80)
request_module: runaway loop modprobe binfmt-0000
Starting init: /bin/sh exists but couldn't execute it (error -8)
Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU1: stopping
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.9.0-xilinx-v2017.4 #1
Hardware name: Xilinx Zynq Platform
[<c010e244>] (unwind_backtrace) from [<c010a4a4>] (show_stack+0x10/0x14)
[<c010a4a4>] (show_stack) from [<c02e15d0>] (dump_stack+0x80/0x9c)
[<c02e15d0>] (dump_stack) from [<c010c9f8>] (ipi_cpu_stop+0x3c/0x70)
[<c010c9f8>] (ipi_cpu_stop) from [<c010d210>] (handle_IPI+0x64/0x84)
[<c010d210>] (handle_IPI) from [<c0101420>] (gic_handle_irq+0x78/0x94)
[<c0101420>] (gic_handle_irq) from [<c010ae8c>] (__irq_svc+0x6c/0xa8)
Exception stack(0xde471f70 to 0xde471fb8)
1f60:                                     00000000 0000002d 1e29b000 debdc9c0
1f80: 63d90498 0000002d debdbe40 00000000 63536ad7 0000002d 00000000 00000000
1fa0: 0000000b de471fc0 c04b6978 c04b699c 60000113 ffffffff
[<c010ae8c>] (__irq_svc) from [<c04b699c>] (cpuidle_enter_state+0xe4/0x1b0)
[<c04b699c>] (cpuidle_enter_state) from [<c014c834>] (cpu_startup_entry+0x17c/0x19c)
[<c014c834>] (cpu_startup_entry) from [<001014cc>] (0x1014cc)
---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.

I checked the sub-sector and erase size in the datasheet and looks to be set-up correctly in petalinux (4k erase, 64k subsector). As for the magic bitmask, I looked it up and it seems like the filesystem image is wrong? I used the one generated by petalinux. If you have any further suggestions please let me know. Thanks!

0 Kudos
Moderator
Moderator
2,078 Views
Registered: ‎06-27-2017

Re: Modifying filesystem Petalinux

@bog_dan

 

Petalinux may not generated the required erase block size for your flash part configuration. Please use below command to generate the JFFS2 filesystem.

 

mkfs.jffs2 -d=<path where rootfs.tar.gz is extracted> -e <erase size as got from the mtdinfo command> -p -o rootfs.jffs2 (if dual parallel configuration is used then multiply the erase size by 2 got from the mtdinfo command)

 

e.g. For flash part having erase block size of 8Kb,

mkfs.jffs2 --root=rootfs --eraseblock=0x2000 -p -o rootfs.jffs2

 

 

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

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