Difference between revisions of "Loading JFFS2 Images Onto a Board"

From wiki.emacinc.com
Jump to: navigation, search
(Full Examples)
 
(34 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{todo|Add some text (11.06.13-08:24->MW+)(11.06.13-17:55->MD+)|Michael Welling|project=oe 4,oe 5,mw,md,InProgress}}
+
{{todo|SEOKWREV, held for FTP server update; (11.06.13-08:24->MW+)(11.06.13-17:55->MD+)(12.11.13-13:56->MW+)(12.19.13-18:40->MD+);(12.20.13-11:30->KY+);(03.06.14-15:05->BS-);(04.11.14-11:35->BS+)|Michael Welling|project=oe 4,oe 5,mw,md,bs,SEOKWREV}}
 +
 
 +
{{#seo:
 +
|title=Loading JFFS2 Images Onto a Board
 +
|titlemode=append
 +
|keywords=JFFS2,U-Boot,TFTP Server
 +
|description=The section provides links and useful information for performing JFFS2 programming using U-Boot and Redboot.
 +
}}
 
== Background ==
 
== Background ==
  
Journalling Flash File System version 2 or JFFS2 is a log-structured file system used on flash memory devices. JFFS2 images are typically created on a development PC and deployed to an embedded target using TFTP commands from the target's bootloader. Deployment requires both serial and Ethernet connections to the board along with a TFTP server set up on your development machine.
+
Journalling Flash File System version 2, or JFFS2, is a log-structured file system used on flash memory devices. JFFS2 images are typically created on a development PC and deployed to an embedded target using TFTP commands from the target's bootloader. Deployment requires both serial and Ethernet connections to the board along with a TFTP server set up on a development machine.
  
For instructions on installing a TFTP server on your development PC:
+
For instructions on installing a TFTP server on a development PC:
 
[[Installing TFTP server]]
 
[[Installing TFTP server]]
  
Line 11: Line 18:
  
 
JFFS2 file systems are available for download on [ftp://ftp.emacinc.com EMAC's FTP site].
 
JFFS2 file systems are available for download on [ftp://ftp.emacinc.com EMAC's FTP site].
'''We really, really, really need to update our public FTP site'''
 
  
 
For instructions on creating a JFFS2 file system image see the following page:
 
For instructions on creating a JFFS2 file system image see the following page:
Line 17: Line 23:
  
 
== General Information ==
 
== General Information ==
Before attempting to program an target, a serial connection is required to access the board's bootloader.
+
The section below provides links and useful information for performing JFFS2 programming using U-Boot and Redboot. The links provide pages with the generic procedures for programming EMAC modules based on the bootloader type.
  
 
=== Using U-Boot ===
 
=== Using U-Boot ===
Line 24: Line 30:
 
[[Loading Images with U-Boot]]
 
[[Loading Images with U-Boot]]
  
 
+
From the U-Boot prompt it is possible to set the target's IP address dynamically using DHCP:
From the U-Boot prompt it is possible to set target's IP address dynamically using DHCP:
 
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
 
U-Boot> set autoload no
 
U-Boot> set autoload no
Line 33: Line 38:
 
The target's IP can also be manually set using the <code>ipaddr</code> environment variable as follows:
 
The target's IP can also be manually set using the <code>ipaddr</code> environment variable as follows:
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
 
 
U-Boot> set ipaddr 192.168.0.101
 
U-Boot> set ipaddr 192.168.0.101
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 39: Line 43:
 
Once the target IP is set, the TFTP server's IP address must be specified:
 
Once the target IP is set, the TFTP server's IP address must be specified:
 
<syntaxhighlight lang="console">
 
<syntaxhighlight lang="console">
 
 
U-Boot> set serverip 192.168.0.100
 
U-Boot> set serverip 192.168.0.100
 
</syntaxhighlight>
 
</syntaxhighlight>
  
The configuration of the bootloader environment can be checked at any time using the <code>printenv</code> command. As described in [[Loading Images with U-Boot]], the JFFS2 image will then be loaded into SDRAM programmed into flash. A full example will be provided below for the SoM-9G45.
+
The configuration of the bootloader environment can be checked at any time using the <code>printenv</code> command. As described in [[Loading Images with U-Boot]], the JFFS2 image will then be loaded into SDRAM and programmed into flash. A full example for the SoM-9G45 will be provided below.
 
 
=== Using Redboot ===
 
Refer to the following page for instructions on accessing Redboot on the serial console and loading images:
 
[[Loading Images with RedBoot]]
 
 
 
=== Full Examples ===
 
  
 +
== Full Example Using U-Boot (SoM-9G45) ==
 +
This section provides a detailed example of loading a JFFS2 file system onto the SoM-9G45 and shows how U-Boot responds to the various commands when performed successfully.
 +
 
  U-Boot 2009.06-rc1-svn1786 (Nov 28 2011 - 17:22:29)  
 
  U-Boot 2009.06-rc1-svn1786 (Nov 28 2011 - 17:22:29)  
 +
 
  EMAC Inc. SOM-9M10/G45M  
 
  EMAC Inc. SOM-9M10/G45M  
 +
 
  I2C:  ready
 
  I2C:  ready
 
  DRAM:  128 MB
 
  DRAM:  128 MB
Line 61: Line 63:
 
  Size= 4325376 bytes
 
  Size= 4325376 bytes
 
  Logical address: 0xC0000000
 
  Logical address: 0xC0000000
  Area 0: C0000000 to C00041FF (RO)
+
  Area 0: C0000000 to C00041FF (RO) Bootstrap
  Bootstrap Area 1: C0004200 to C00083FF    
+
  Area 1: C0004200 to C00083FF     Environment
  Environment Area 2: C0008400 to C0041FFF (RO)
+
  Area 2: C0008400 to C0041FFF (RO) U-Boot
U-Boot Area 3: C0042000 to C0251FFF    
+
Area 3: C0042000 to C0251FFF     Kernel
  Kernel Area 4: C0252000 to C041FFFF    
+
  Area 4: C0252000 to C041FFFF     FS
  FS In:  
+
  In:   serial
  serial Out:
+
  Out:   serial
  serial Err:
+
  Err:   serial
  serial Net:
+
  Net:   macb0
  macb0 macb0: Starting autonegotiation...
+
  macb0: Starting autonegotiation...
 
  macb0: Autonegotiation complete
 
  macb0: Autonegotiation complete
 
  macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
 
  macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
Line 77: Line 79:
 
  U-Boot> dhcp
 
  U-Boot> dhcp
 
  macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
 
  macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
  BOOTP broadcast 1 DHCP
+
  BOOTP broadcast 1
  client bound to address 10.0.2.221
+
  DHCP client bound to address 10.0.2.221
 
  U-Boot> set serverip 10.0.2.168
 
  U-Boot> set serverip 10.0.2.168
 
  U-Boot> tftp 0x74000000 som-9g45m-rootfs.jffs2
 
  U-Boot> tftp 0x74000000 som-9g45m-rootfs.jffs2
 
  macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
 
  macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
  Using macb0 device TFTP from server 10.0.2.168;
+
  Using macb0 device
our IP address is 10.0.2.221
+
TFTP from server 10.0.2.168; our IP address is 10.0.2.221
 
  Filename 'som-9g45m-rootfs.jffs2'.
 
  Filename 'som-9g45m-rootfs.jffs2'.
  Load address: 0x74000000 Loading:
+
  Load address: 0x74000000
        #################################################################  
+
Loading: #################################################################  
        #################################################################
+
                                  ...
        #################################################################  
+
          ####################################################
        #################################################################
+
done
        #################################################################
+
  Bytes transferred = 27473444 (1a33624 hex)
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        #################################################################
 
        ####################################################
 
  done Bytes transferred = 27473444 (1a33624 hex)
 
 
  U-Boot> nand erase
 
  U-Boot> nand erase
 +
 
  NAND erase: device 0 whole chip
 
  NAND erase: device 0 whole chip
 
  Skipping bad block at  0x03320000                                             
 
  Skipping bad block at  0x03320000                                             
Line 124: Line 102:
 
  OK
 
  OK
 
  U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}
 
  U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}
 +
 
  NAND write: device 0 offset 0x0, size 0x1a33624
 
  NAND write: device 0 offset 0x0, size 0x1a33624
 
  NAND write: Padding to page size...  
 
  NAND write: Padding to page size...  
Line 129: Line 108:
 
  U-Boot>
 
  U-Boot>
  
'''This would also be a good place to note that they may have to change their video settings for their board, or set other kernel commandline arguments.  You can link them to documentation for the kernel for this.  The video settings information would be good to have in the quick reference section below, though.  A quick reference by carrier type section, for our standard carriers, would be a good place for this.  Also, anything else that you can think of that might be specific to a carrier should be there.  Alternatively, maybe we should have a different page for this.  That way, we could share it across different pages for different image types. If you choose that route, then the page will need to be "bragged about" here, so that people will be sure to look at the page rather than e-mailing us, "my screen doesn't work."  You will probably also want to figure out a better formatting than the quick bit I added here.'''
+
== Quick Reference (By Target Type) ==
 +
This section provides a quick reference for programming various targets with a JFFS2 image.
 +
It is assumed that the Ethernet setup is performed as described above in the General Information section.
  
== Quick Reference (By Target Type) ==
 
 
=== SoM-9260M ===
 
=== SoM-9260M ===
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
Line 138: Line 118:
 
U-Boot> erase 0x10400000 0x11ffffff
 
U-Boot> erase 0x10400000 0x11ffffff
 
U-Boot> cp.b 0x20000000 0x10400000 ${filesize}
 
U-Boot> cp.b 0x20000000 0x10400000 ${filesize}
 +
# Erase the second bank for 64Mb modules
 +
U-Boot> erase 0x12000000 0x13ffffff
 +
# OE 4 - set filesystem read/write on first boot
 +
U-Boot> setenv bootargs 'console=ttyS3,115200 root=/dev/mtdblock3 rootfstype=jffs2 rw'
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 160: Line 144:
 
U-Boot> nand erase
 
U-Boot> nand erase
 
U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}
 
U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}
</syntaxhighlight>
 
 
=== SoM-9307M ===
 
<syntaxhighlight lang="bash">
 
Redboot> fis unlock -f 0x60000000 -l 0x1fdffff
 
Redboot> load -r -v -b 0x300000 -h 10.0.2.60 som-9307m-rootfs.jffs2
 
Redboot> fis create -b 0x300000 -l 0x1c00000 jffs2
 
</syntaxhighlight>
 
 
=== IPAC-9302 ===
 
<syntaxhighlight lang="bash">
 
Redboot> fis unlock -f 0x60000000 -l 0x1fdffff
 
Redboot> load -r -v -b 0x300000 -h 10.0.2.60 ipac-9302-rootfs.jffs2
 
Redboot> fis create -b 0x300000 -l 0x1c00000 jffs2
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 10:23, 5 June 2018

TODO: {{#todo:SEOKWREV, held for FTP server update; (11.06.13-08:24->MW+)(11.06.13-17:55->MD+)(12.11.13-13:56->MW+)(12.19.13-18:40->MD+);(12.20.13-11:30->KY+);(03.06.14-15:05->BS-);(04.11.14-11:35->BS+)|Michael Welling|oe 4,oe 5,mw,md,bs,SEOKWREV}}

Background

Journalling Flash File System version 2, or JFFS2, is a log-structured file system used on flash memory devices. JFFS2 images are typically created on a development PC and deployed to an embedded target using TFTP commands from the target's bootloader. Deployment requires both serial and Ethernet connections to the board along with a TFTP server set up on a development machine.

For instructions on installing a TFTP server on a development PC: Installing TFTP server

For details on connecting to the serial port for an embedded target: Serial Connections

JFFS2 file systems are available for download on EMAC's FTP site.

For instructions on creating a JFFS2 file system image see the following page: Creating JFFS2 Images

General Information

The section below provides links and useful information for performing JFFS2 programming using U-Boot and Redboot. The links provide pages with the generic procedures for programming EMAC modules based on the bootloader type.

Using U-Boot

Refer to the following pages for instructions on accessing U-Boot on the serial console:
U-Boot Overview
Loading Images with U-Boot

From the U-Boot prompt it is possible to set the target's IP address dynamically using DHCP:

U-Boot> set autoload no
U-Boot> dhcp

The target's IP can also be manually set using the ipaddr environment variable as follows:

U-Boot> set ipaddr 192.168.0.101

Once the target IP is set, the TFTP server's IP address must be specified:

U-Boot> set serverip 192.168.0.100

The configuration of the bootloader environment can be checked at any time using the printenv command. As described in Loading Images with U-Boot, the JFFS2 image will then be loaded into SDRAM and programmed into flash. A full example for the SoM-9G45 will be provided below.

Full Example Using U-Boot (SoM-9G45)

This section provides a detailed example of loading a JFFS2 file system onto the SoM-9G45 and shows how U-Boot responds to the various commands when performed successfully.

U-Boot 2009.06-rc1-svn1786 (Nov 28 2011 - 17:22:29) 

EMAC Inc. SOM-9M10/G45M 

I2C:   ready
DRAM:  128 MB
NAND:  256 MiB
DataFlash:AT45DB321
Nb pages:   8192
Page Size:    528
Size= 4325376 bytes
Logical address: 0xC0000000
Area 0: C0000000 to C00041FF (RO) Bootstrap
Area 1: C0004200 to C00083FF      Environment
Area 2: C0008400 to C0041FFF (RO) U-Boot
Area 3: C0042000 to C0251FFF      Kernel
Area 4: C0252000 to C041FFFF      FS
In:    serial
Out:   serial
Err:   serial
Net:   macb0
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
Hit any key to stop autoboot:  0 
U-Boot> set autoload no 
U-Boot> dhcp
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
BOOTP broadcast 1
DHCP client bound to address 10.0.2.221
U-Boot> set serverip 10.0.2.168
U-Boot> tftp 0x74000000 som-9g45m-rootfs.jffs2
macb0: link up, 100Mbps full-duplex (lpa: 0xcde1)
Using macb0 device
TFTP from server 10.0.2.168; our IP address is 10.0.2.221
Filename 'som-9g45m-rootfs.jffs2'.
Load address: 0x74000000
Loading: ################################################################# 
                                  ...
         ####################################################
done
Bytes transferred = 27473444 (1a33624 hex)
U-Boot> nand erase

NAND erase: device 0 whole chip
Skipping bad block at  0x03320000                                            
Skipping bad block at  0x079e0000                                            
Skipping bad block at  0x085e0000                                            
Erasing at 0xffe0000 -- 100% complete.
OK
U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}

NAND write: device 0 offset 0x0, size 0x1a33624
NAND write: Padding to page size... 
27473444 bytes written: OK
U-Boot>

Quick Reference (By Target Type)

This section provides a quick reference for programming various targets with a JFFS2 image. It is assumed that the Ethernet setup is performed as described above in the General Information section.

SoM-9260M

U-Boot> tftp 0x20000000 som-9260m-rootfs.jffs2
U-Boot> protect off all
U-Boot> erase 0x10400000 0x11ffffff
U-Boot> cp.b 0x20000000 0x10400000 ${filesize}
# Erase the second bank for 64Mb modules
U-Boot> erase 0x12000000 0x13ffffff
# OE 4 - set filesystem read/write on first boot
U-Boot> setenv bootargs 'console=ttyS3,115200 root=/dev/mtdblock3 rootfstype=jffs2 rw'

SoM-9G20M

U-Boot> tftp 0x20000000 som-9g20m-rootfs.jffs2
U-Boot> nand erase
U-Boot> nand write.jffs2 0x20000000 0x0 ${filesize}

SoM-9G45M

U-Boot> tftp 0x74000000 som-9g45m-rootfs.jffs2
U-Boot> nand erase
U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}

SoM-9M10M

U-Boot> tftp 0x74000000 som-9m10m-rootfs.jffs2
U-Boot> nand erase
U-Boot> nand write.jffs2 0x74000000 0x0 ${filesize}