Uboot's support for the jffs2 File System

Source: Internet
Author: User
We know from the uboot code that uboot supports several common file systems in Linux, such as cramfs, ext2, and jffs2. Since the root file system used in my Linux system is jffs2, I want to make uboot unable to support the jffs2 file system, and then put the Linux kernel directly into the root file system. uboot will read the kernel and start it again, A flash partition can be reduced. After the Linux system is up, you do not need to re-burn the kernel partition to update the kernel. You only need to get a kernel file, which is much less required.
The answer is yes, and the change is also very simple, but the premise is that the flash read and write operations are normal, this can be found in "Flash debugging experience in rm9200 uboot" in this forum.
In the include/configs/at91rm9200dk. h configuration file, define:
# UNDEF config_jffs2_cmdline
# Define config_jffs2_dev "nor0"
# Define config_jffs2_part_size 0x1c0000
# Define config_jffs2_part_offset 0x40000

Uboot supports multiple jffs2 partitions. You can use commands to set partitions and activate different working partitions. However, since we do not need to have too many operations in uboot (a key problem is that uboot cannot write files, but can only read files, and cannot do too many meaningful tasks), we do not support command partitioning on jffs2, only one jffs2 partition is supported. The partition size defined in the preceding parameters is better understood than the start offset of the partition. In fact, my flash is divided into three zones: uboot, rootfs, userfs, and rootfs. The starting address of the rootfs partition is 0x40000, And the size is 0x1c0000, which is the parameter value set above.

Set the uboot startup parameter to # define config_bootcommand "fsload uimage; bootm"
Put the Linux Kernel File uimage in the root file system. After the file is started, it is as follows:
U-Boot Code: 21f00000-> 21f21f48 BSS:-> 21f3fa88
Ram Configuration:
Bank #0: 20000000 32 MB
SST 39vf3201 flash
Flash: 4 MB
Nand: 64 MB
In: Serial
Out: Serial
Err: Serial
Hit any key to stop autoboot: 0
Uboot> ls
Scanning jffs2 FS:... done.
Drwxr-XR-x 0 Wed May 02 06:36:59 2007 Dev
Drwxr-XR-x 0 sun APR 01 08:23:29 2007 home
Drwxr-XR-x 0 Sat Jun 02 12:23:10 2007 Bin
Drwxr-XR-x 0 sat May 12 03:21:46 2007 OPT
Drwxr-XR-x 0 Sat Jun 02 12:23:10 2007 sbin
Drwxr-XR-x 0 Wed May 09 13:33:23 2007 mnt
Drwxr-XR-x 0 sun APR 01 08:23:51 2007 USR
Drwxr-XR-x 0 Tue Jun 19 13:09:31 2007 lib
Drwxr-XR-x 0 Wed May 30 12:36:11 2007 etc
Drwxr-XR-x 0 sun APR 01 08:23:29 2007 Root
Lrwxrwxrwx 11 Sat Jun 02 12:23:10 2007 linuxrc-> bin/busybox
Lrwxrwxrwx 12 sun May 27 01:08:47 2007 var->/mnt/RAM/var
Lrwxrwxrwx 9 sun May 27 01:07:02 2007 proc->/tmp/proc
Lrwxrwxrwx 16 sun May 27 01:07:50 2007 TMP->/mnt/RAM/var/tmp
-RW-r -- 1071560 Thu Jan 01 00:01:42 1970 uimage
Uboot>

The Linux kernel is started as follows. Obviously, the jffs2 file system is successfully started from uboot:
U-boot 1.1.4 (Jun 26 2007-17:39:49)
U-Boot Code: 21f00000-> 21f21f48 BSS:-> 21f3fa88
Ram Configuration:
Bank #0: 20000000 32 MB
SST 39vf3201 flash
Flash: 4 MB
Nand: 64 MB
In: Serial
Out: Serial
Err: Serial
Hit any key to stop autoboot: 0
### Jffs2 loading 'uimage' to 0x20008000
Scanning jffs2 FS:... done.
### Jffs2 load complete: 1071560 bytes loaded to 0x20008000
# Booting image at 20008000...
Image name: Linux-2.6.14
Created: 2007-06-27 13:04:05 UTC
Image Type: ARM Linux kernel image (uncompressed)
Data size: 1071496 bytes = 1 MB
Load address: 20008000
Entry Point: 20008040
Verifying checksum... OK
Xip kernel image... OK

Starting kernel...

Uncompressing Linux ...................................... ....................... linux version 2.6.14 (root@localhost.localdomain) (GCC version 3.4.1) #74 wed j7cpu: arm920tid (WB)
[41129200] Revision 0 (armv4t)
MACHINE: Atmel AT91RM9200-DK
Memory Policy: ECC disabled, data cache writeback
Clocks: CPU 179 MHz, Master 59 MHz, main 18.432 MHz
Cpu0: D vivt write-back Cache
Cpu0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Cpu0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: Mem = 32 m noinitrd console = ttys0, 115200 init =/linuxrc root =/2at91: 128 gpio irqs in 4 banks
PID hash table entries: 256 (Order: 8, 4096 bytes)
Console: Color dummy device 80x30
Dentry cache hash table entries: 8192 (Order: 3, 32768 bytes)
Inode-Cache hash table entries: 4096 (Order: 2, 16384 bytes)
Memory: 32 MB = 32 MB total
Memory: 30366kb available (1795 K code, 344 K data, 96 k init)
Mount-Cache hash table entries: 512
CPU: Testing write buffer coherency: OK
Softlockup Thread 0 started up.
Net: Registered protocol family 16
Netwinder floating point emulator v0.97 (Double Precision)
Devfs: Richard Gooch (rgooch@atnf.csiro.au)
Devfs: boot_options: 0x1
Jffs2 Version 2.2. (NAND) (c) 2001-2003 Red Hat, Inc.
Jffs2: Default compression mode: Priority
Yaffs Jun 27 2007 21:03:42 installing.
......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.