banner



Can I Upload A File Into Jffs Directory

BBC User's Guide

Introduction

BBC (Cake Based Compression framework) is an extension to the JFFS2 [1] file system used in embedded systems with Linux. JFFS2 has a compression feature which uses zlib for pinch. BBC replaces zlib with a compressor framework, which is able to utilise an arbitrary set of compressors.

JFFS2 is a block based file system, so the stored information is compressed in blocks individually.

There are ii kinds of compressors. A compressor plugin can exist model-based or non-model-based. Model based compressors have the possiblity to collect information almost the whole file organization and store it into a (model) file which will be avaiable when the block of the file system is being compressed/decompressed. (zlib is a non-model-based i.)

BBC framework

Method Overview

JFFS2 is a cake based file organization, so the stored information is compressed in blocks individually. BBC is a complete compression framework, which has the adequacy to make this compression more powerful.
Figure 1: Overview of BBC

\includegraphics[scale=0.7]{overview.eps}

As we mentioned in a higher place there are two kinds of compressors:

Not-model-based ones
compress the block individually. (e.m. compressor B)
Model based ones
accept the possiblity to collect information about the whole file organisation and store information technology into a (model) file which will be avaiable when the block of the file organisation is beingness compressed/decompressed. (due east.k. compressor A)

At that place are iii phases:

model generation:
Model based compressors take to generate model file(s). The compression and decompression will exist done using these models. The input of this step is a file construction, the output is one or more than model file. The model-based compressors must provide their model creator programs. (modelgen programs)
file organization image creation:
The input of this phase is a file structure, the output is an image file. It is done by the plan mkfs.jffs2. The files are first dissever into blocks of a given size ane , and each block is compressed with one of the compressors (depending on the compression mode). For special reasons, the model(due south) and some operating system file blocks must be compressed with zlib.
active usage of file system:
After the epitome is ready, it is flashed onto a real device (for instance an iPAQ or an Innovator Lath). When these machines are operating and a file is read, the file system knows how to decompress each block of the file (due to a kernel modification), and assembles it. When a file is written (either modifying an existing file or creating a new ane), the process is the aforementioned every bit in the prototype creation stage.

Compression modes

JFFS2 stores files in blocks, and every block is compressed individually. BBC uses the first two bytes of the compressed blocks to place the corresponding compressor (and if necessary the model file). To compress a block the following compression modes can be used:

zlib style:
in this fashion the compressor framework always chooses zlib. You must employ it for example to upload kernel files (because of compatibility). This is the deafult.
size style:
in this style the compressor framework tries out all compressors with all matching models, and chooses the best (smallest) consequence. It serves the all-time compression ratio.
fastr style:
in this mode the compressor framework calls the read speed estimator function of all compressors (using the model file which has the highest block signature) and uses the about promising one to compress the cake - if it fails, zlib will exist called. This way produces a slightly worse compression ratio than size mode, but it should exist much faster in reading.
fastw mode:
the same as in a higher place but calls the write speed estimator function.
fasts way:
the same as above simply calls the compressed size estimator function.
manual mode:
in this style the user can specify a compressor. The framework will always phone call the specified compressor (with all matching model files), or if this fails zlib will exist called.
dummy mode:
does not compress
Important notation: in that location is a further possibility to command/melody the compression: the user tin can deactivate/activate every compressor individually. If a compressor is deactivated information technology will exist ignored in every compression fashion. Encounter Section 2.4.

Creation of a file system image

In this section the basic steps are given on how to create a working system with BBC tools. A proper cross-compiler (GCC) and Linux kernel source should exist available on the host motorcar in order to be able to perform the following steps.

  1. Compile model generators and mkfs.jffs2 as described in Section two.6.1 and 2.six.3.
  2. Compile the kernel for the embadded system (if you lot need), come across Section 2.6.two.
  3. After this, create a directory which will exist the root of the file system (referred to as $(ROOT) in the post-obit). Create the directory structure you wish in $(ROOT) and copy all the needed files.
  4. Generate model file(s) using the modelgen programs for the directory $(ROOT). See the documentation of the compressor plugins!
  5. Copy the kernel files into the appropriate (usually kick) directories under $(ROOT).
  6. Re-create the model file(south) into $(ROOT).
  7. Create a configuration file (described in Section 2.seven) that contains the model file name in the outset line (or if you have multiple model files put them into further lines). It is followed by a line that contains only a "-" character. The remaining lines tin comprise the names of special files and the proper name of the required compressor separated by ":" (east.g. kernel files need to be compressed past zlib, and then its lines are "boot/kernel_img:ZLIB").
  8. Put this configuration file into $(ROOT), and rename it to bbc.conf.
  9. Finally invoke mkfs.jffs2 for $(ROOT) (come across Section two.7). This creates the epitome that tin can exist flashed.

Active usage of the file system

If the image is set, it can be flashed onto the embedded system (eg. iPAQ or Innovator board). This image may contain model file(s), and may contain kernel file(southward) in a bootable format. Of course, these kernel files must be created from the kernel source modified by BBC to be able to decompress blocks compressed by orher compressors. (See Section two.6.2)

Using these modified kernel versions at that place will be a new file in the proc file system called /proc/jffs2_bbc. From this file you tin can get some information and statistics well-nigh the BBC subsystem (loaded compressors, models, compression statistics, etc.). You can as well give a command to BBC by writing to this file. Valid commands are:

cm

Due south switch to size compression way
FR switch to fastr compression mode
FW switch to fastw compression mode
FS switch to fasts pinch fashion
Z switch to zlib pinch way
D switch to dummy compression style
M:compressor_name switch to manual pinch mode
0:compressor_name conciliate the specified compressor
ane:compressor_name activate the specified compressor
R reload bbc.conf and load/unload
model files on every file system
C:compressor_name:control give a command to the compressor
cm Valid compressor commands can be constitute in the description of the compressors.

The effect of the commands can be checked by reading the file /proc/jffs2_bbc.

Uploading a new model file

The model files of the model-based compressor are created peculiarly for the given file organization and it is not efficient to compress new (nonseen) files. If y'all upload new files onto the system almost every new cake will be compressed with the non-model-based compressors.

A better solution tin can be the following procedure:

  1. Create a new model file for the new executables
  2. Upload the new model file to the root directory of the file system. Use the zlib pinch method! Insert the proper name of the new model files into the file of bbc.conf. (see Section 2.3)
  3. Activate the new model file using the proc interface of BBC by the following command: echo R >/proc/jffs2_bbc or reboot the organization.
  4. Upload the new files to the system.

Note: every model file must accept a different cake signature (run across the BBC Technical Documentation and the documentations of the compressor plugins). The size compression mode tries out every model file, fastX modes employ only ane model per compressor (which has the highest cake signature).

Compiling BBC tools and source details

This is the directory structure of BBC:

doc
documentation
src/jffs2
source of the framework, filesystem modification and the comprssor/decompressor function of the compressor plugins
src/util
source of the mkfs modification and the model generation function of the model based compressors
src/patches
special patch utility and patch files for different kernel versions and mtd-util.
src/exam
test utilities
src/models
pregenerated model files

Compiling model generators

Enter src/util and type make! You will detect some modelgen.30 executables where thirty is the name of the compressor.

Compiling the kernel

Employ the specific hpatch file using src/install.jffs2, and compile your kernel! The first parameter of the script is the name of the hpatch, the second is the kernel directory. Yous can ask a listing of the avaiable hpatch files with paramter -50:

hafy@kpax:~/dev/bbc/src$ ./install.jffs2 -l linux-2.four.19-rmk6-pxa1-hh30.hpatch  linux-2.4.25.hpatch linux-2.half-dozen.3.hpatch hafy@kpax:~/dev/bbc/src$ ./install.jffs2 linux-two.4.25.hpatch /usr/src/linux/      
The hpatch files are as general as possible - for example you can use the hpatch of 2.4.25 for almost all not also old 2.iv.ten kernels. If you downloaded the source of BBC from CVS, brand sure, that src/pathes/hpatch script is executable, and the kickoff line points to the location of the perl interpreter! If the patching is successful you can individually select the compressor plugins (with make menuconifg).

Compiling mkfs

Follow these steps:

  1. Download the lastest MTD source from http://www.linux-mtd.infradead.org/, or use some later version if you want.
  2. Blazon make mkfs.jffs2 to make some symlinks (it is necessary simply for some older versions of MTD)!
  3. Apply the specific hpatch file using src/install.mkfs. The usage of this script is similar to the one above.
  4. Blazon make mkfs.jffs2 in the directory of util of the mtd source, and you will get the mkfs.jffs2 binary.

Using mkfs.jffs2

This program creates a file organization image according to the desired compression mode (Come across Section 2.iii). Before invoking the plan, the directory construction of the epitome must exist created with the model file copied into the root directory of the epitome.

The input is the root directory of the directory structure that will be flashed. The model file has to be in the root of this structure. In that location besides must be an bbc.conf file. Run into details beneath.

Output: the image of the file organization that tin exist flashed onto the embadded arrangement.

mkfs.jffs2 [-chiliad,--pinch-way=mode]            [-x,--disable-compressor=name_of_the_compressor]            [-b,--big-endian -50,--footling-endian] [-eastward,--eraseblock=SIZE]            [-southward,--pagesize=SIZE] [-p,--pad[=SIZE]] [-h,--help]            [-5,--version] [-d,-r,--root directory] -o,--output image.jffs2     -x,--disable-compressor=name_of_the_compressor                       Disabling the specified compressor   -one thousand,--compressor-mode=name_of_the_compressor                       Fix the compression mode. 		      Avaiable: size (default), fastr, fastw, fasts, zlib    -b,--big-endian     These options specify the endianness of the image. Just   -l,--lilliputian-endian  i can be used at a time. [def: same as host]    -east,--eraseblock     Size of erasable blocks [def: 64kB]   -s,--pagesize       Size of a page [def: 4kB]   -p,--pad            Padding size [def: end of concluding erase block]   -d,-r,--root        Root directory of the paradigm [def: current dir]   -o,--output         Output file  Example:    mkfs.jffs2 -rroot_fs -oroot.jffs2      

Options that accept SIZE arguments can be specified either as decimal (eastward.chiliad., 65536), octal (0200000), or hexadecimal (0x1000).

-b, -big-endian, -l, -little-endian
These options specify the endianness of the created image. -b and -big-endian mean large-endian, -fifty and -fiddling-endian hateful little-endian image. Only one of these options tin be used at a time. The default is to make an image with the same endianness every bit the host. This value must exist the same as that of modelgen.
-yard, -compression-mode=fashion
See department Compression modes. Only one of these options can be used at a time. The default is to make an paradigm with size way.
-ten, -disble-compressor=name
Disable the specified compressor.
-e, -eraseblock
This option sets the size of the erasable block. The default is 64 kB. If an erase cake size different than the erase block size of the target device is used, JFFS2 may not perform optimally.
-southward, -pagesize
This pick sets the page size. The default is 4 kB. This size is the maximum size of a data node. This value should be the aforementioned every bit the value of -blocksize parameter of plan modelgen.armlib.
-p, -pad
Sets the size of padding. If non specified, the output is padded to the terminate of the last erase block. The padded bytes get the value 0xFF.
-d, -r, -root
The specified directory will be the root directory of the image. The default value is the current directory.
-o, -output
This specifies the file where the image is written.
-h, -assistance
Displays help.
-v, -version
Displays version information.
Configuration file (bbc.conf)
This configuration file is a text file, in which every line contains a file name relative to the specified root directory. Information technology has 2 parts, separated past a line that contains a "-" character simply. In the commencement part at that place are the names of the model files (one per line). They must be in the root directory of the image. In the second part the lines contain the proper noun of the file and optionally a compressor name separated with ":". For examle:
usr/bin/something:armlib
All files listed in the configuration file are compressed using the specified compressor (or with zlib if no compressor is specified). A complete example:
armlib-1.model armlib-2.model - boot/zImage          

Compressors

They are described in seperated documents.

Bibliography

one
David Woodhouse.:
JFFS: The Journalling Fash File System.
January 2001.
http://sources.redhat.com/jffs2/

About this document ...

BBC User'south Guide

This document was generated using the LaTeXtwoHTML translator Version 2002-two-1 (1.lxx)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Figurer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 0 -no_navigation user.tex

The translation was initiated by Havasi Ferenc on 2004-03-02


Footnotes

... size i
Typical size of a block is 4Kb.


Havasi Ferenc 2004-03-02

Source: http://www.inf.u-szeged.hu/jffs2/user/

Posted by: whiteliontion.blogspot.com

0 Response to "Can I Upload A File Into Jffs Directory"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel