xref: /openbmc/u-boot/doc/README.JFFS2 (revision 713cb680)
1JFFS2 options and usage.
2-----------------------
3
4JFFS2 in U-Boot is a read only implementation of the file system in
5Linux with the same name. To use JFFS2 define CONFIG_CMD_JFFS2.
6
7The module adds three new commands.
8fsload  - load binary file from a file system image
9fsinfo  - print information about file systems
10ls      - list files in a directory
11chpart  - change active partition
12
13If you boot from a partition which is mounted writable, and you
14update your boot environment by replacing single files on that
15partition, you should also define CONFIG_SYS_JFFS2_SORT_FRAGMENTS. Scanning
16the JFFS2 filesystem takes *much* longer with this feature, though.
17Sorting is done while inserting into the fragment list, which is
18more or less a bubble sort. That algorithm is known to be O(n^2),
19thus you should really consider if you can avoid it!
20
21
22There is two ways for JFFS2 to find the disk. The default way uses
23the flash_info structure to find the start of a JFFS2 disk (called
24partition in the code) and you can change where the partition is with
25two defines.
26
27CONFIG_SYS_JFFS2_FIRST_BANK
28	defined the first flash bank to use
29
30CONFIG_SYS_JFFS2_FIRST_SECTOR
31	defines the first sector to use
32
33
34The second way is to define CONFIG_SYS_JFFS_CUSTOM_PART and implement the
35jffs2_part_info(int part_num) function in your board specific files.
36In this mode CONFIG_SYS_JFFS2_FIRST_BANK and CONFIG_SYS_JFFS2_FIRST_SECTOR is not
37used.
38
39The input is a partition number starting with 0.
40Return a pointer to struct part_info or NULL for error;
41
42Ex jffs2_part_info() for one partition.
43---
44#if defined CONFIG_SYS_JFFS_CUSTOM_PART
45#include <jffs2/jffs2.h>
46
47static struct part_info part;
48
49struct part_info*
50jffs2_part_info(int part_num)
51{
52	if(part_num==0){
53		if(part.usr_priv==(void*)1)
54			return &part;
55
56		memset(&part, 0, sizeof(part));
57		part.offset=(char*)0xFF800000;
58		part.size=1024*1024*8;
59
60		/* Mark the struct as ready */
61		part.usr_priv=(void*)1;
62
63		return &part;
64	}
65	return 0;
66}
67#endif
68---
69
70TODO.
71
72	Remove the assumption that JFFS can dereference a pointer
73	into the disk. The current code do not work with memory holes
74	or hardware with a sliding window (PCMCIA).
75