Hardware/ARMEBS/3/RootFileSystem

From UIT
Jump to: navigation, search

Contents

Root File System

Overview

A Linux/GNU system needs at least 2 things to work:

  • a kernel
  • a root filesystem

The root filesystem contains a least one application that the kernel will run after it's initialization.

The linux kernel will mount the root filesystem at the end of it's initialization process, and will run the /sbin/init executable. (see LinuxCommandLine#init)

Comments

The default kernel for the ARMEBS3 should include support for using all kind of root filesystems listed on this page. The purpose of this document is not optimisation of the linux kernel size and performance for a specific situation.

Choosing the root file system device

Choosing the file system is not done at compilation time but is done by setting the linux kernel command line (LinuxCommandLine). For ARMEBS3 boards, u-boot will be used to setup this command line.

The root file system is choosen by the kernel using it's command line option : root, in conjunction with it's following argument if it is either rw or ro.

for instance root=/dev/hda1 rw will boot on the first hard drive of your computer and use it as a read/write filesystem, partition 1.

general format of root option can be seen in the comments of the file linux/trunk/init/do_mounts.c. The root file system type is automatically detected but can be forced using the rootfstype option (rootfstype=ext2 for an ext2 filesystem). Here are some usefull examples for booting on a ARMEBS3

Network file system (NFS) (see also linux/trunk/Documentation/nfsroot.txt)

This setup is very useful for development, you can hold the complete file system on your host (development) machine where they are easy to modify, and this files will be used as the root file system of the ARMEBS3. root=/dev/nfs is the master piece of this setup, but nfsroot and ip must also be set

  • using DHCP :root=/dev/nfs rw nfsroot=153.109.5.233:/opt/armebs3/nfs ip=:::::eth0:dhcp
  • using a static IP address :root=/dev/nfs rw nfsroot=153.109.5.233:/opt/armebs3/nfs ip=153.109.5.232:153.109.5.233:153.109.5.1:255.255.255.0::eth0:off

Will setup the IP address 153.109.5.232, gateway 153.109.5.1 with netmask 255.255.255.0 for the ARMEBS3 board and use the folder /opt/armebs3/nfs on the server 153.109.5.233

don't forget to setup a nfs share with the no_root_squash option (this is dangerous, but this is NOT used in production)

here is /etc/exports working example, with restricted access to the local network:

 # /etc/exports: NFS file systems being exported.  See exports(5).
 /opt/armebs3/nfs 153.109.5.0/255.255.255.0(sync,rw,no_root_squash,no_all_squash)


Flash

a flash device has a finite lifetime , 100K erase cycle for the flash used on the ARMEBS3. Special care must be taken to choose a read/write filesystem for flash.

You can flash a romfs or jffs2 filesystem image in the /dev/mtd4 partition, and boot on it using option

  • root=1f04 or root=/dev/mtdblock4 for booting on the /dev/mtd4 partition
  • when using a jffs2 filesystem, rootfstype=jffs2 must be append.

Don't forget that romfs is read-only and many application need some directory to be writable /tmp and /var/tmp, ... (for instance in a ram disk)

SD or MMC card

  • root=/dev/mmcblk0p1 for MMC or SD card 0 parition 1
  • root=/dev/mmblk0 for using the whole (unpartitioned) card.

USB mass storage device (SCSI enable, as in 2.6.19 and newer)

  • root=/dev/sda1 rootdelay=5 for the first usb mass storage, partition 1
  • root=/dev/sda rootdelay=5 for the the whole (unpartitioned) first usb mass storage.

USB mass storage device (SCSI disable)

  • root=/dev/uba1 for the first usb mass storage, partition 1
  • root=/dev/uba for the the whole (unpartitioned) first usb mass storage.

Notes:

  • The 'first usb device' is on the first USB (USB a on the PCB) port to be verified #21 BR
  • USB flash drive, hard disc or CDROM reader can be used to be verified #22 BR

Compact Flash card

Since linux kernel verion 2.6.14, there is no more need for the userland application cardmgr for booting on compact flash :-)

  • root=/dev/hda1 rootdelay=2 for the first partition on the compact card
  • root=/dev/hda rootdelay=2 for the whole (unpartitioned) compact flash card
Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox