AVR32 Linux Development/Building flash filesystems for the Network Gateway

From AVRFreaks Wiki

Jump to: navigation, search

You should first look into the How_to_make_JFFS_v2_file_system page for a general introduction to the mkfs.jffs2 application.

Contents

Building the root file system

This guide will take you through the steps of what to install and what can be deleted from the file system to give a small memory footprint.

uClibc install and strip

Install the uClibc to your target root directory on the build machine. A standard installation will put the runtime libraries in /lib and the development libraries in /usr/lib. The /usr/lib directory should be cleaned after installing uClibc, since you will not need the development libraries on target.

Other applications and libraries

These are installed binary only if the Makefile allows it, if the Makefile do not support binary install only, do a make install.

Strip not needed directories

After installing the software and libraries a lot of not needed directories can be removed to save space:

  • /usr/man
  • /usr/info
  • /usr/include
  • /usr/share/man
  • /usr/share/info
  • /usr/local

This should reduce the memory footprint. The board support package for the ATNGW100 can be stripped to the directories given below

Directories in /

  bin
  config
  dev
  etc
  home
  lib
  media
  proc
  sbin
  sys
  tmp
  usr
  var
  www

Directories in /usr

  avr32-linux
  bin
  lib
  libexec
  sbin
  share
  swat

Directories in /usr/share

  awk
  udhcpc

NOR flash (parallel)

The NOR flash on the ATNGW100 is used for the U-boot and root filesystem. The U-boot is programmed by using a JTAGICE mkII, while the root filesystem is programmed from Linux.

The image is made by the following command

  • mkfs.jffs2 --output=/path/to/images/atngw100_root.img --root=/path/to/root --big-endian --pagesize=4096 --eraseblock=65536

DataFlash (serial)

The DataFlash on the ATNGW100 is used for the /usr partition. The partition is programmed from Linux.

The image is made by the following command

  • mkfs.jffs2 --output=/path/to/images/atngw100_usr.img --root=/path/to/root/usr --big-endian --no-cleanmarkers --pagesize=1056 --eraseblock=8448

Programming an image in Linux

The mtd-utils software needs to be installed on the target.

Copy the image file over to the target either by network, serial, SD-card or similar. The image is then loaded into flash by using the tool flashcp which is included in mtd-utils.

Copying the root filesystem into the NOR flash on ATNGW100

  • flashcp atngw100_root.img /dev/mtd1

Copying the usr filesystem into the DataFlash on ATNGW100

  • flashcp atngw100_usr.img /dev/mtd3

Telling U-Boot about the flash image

UBoot> set bootargs 'console=ttyS0 root=/dev/mtdblock1 rootfstype=jffs2';fsload;bootm
Static version created: 2007-03-07
Copyright (c) 2007 Atmel Corporation