Creating Root File System

From RCSWiki

Revision as of 14:58, 11 June 2008 by Rsharm14 (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Contents

Getting Started

A Root File System is needed to provide the Linux system with working executables. Without the RFS Linux will boot and then crash since it isn't able to find these executables. To simplify the process we use a script that creates the empty Root File System directory structure and then use BusyBox to populate the directories with executables. Finally, we use a second script to create the RAM Disk image (a compressed file) that is combined with the Linux Kernel and downloaded to the ML-410. This tutorial will explain how the scripts work and how to do everything up to creating the ELF to be downloaded to the ML-410. That will be covered in a later tutorial.

To Begin:

  1. If you haven't done so already, create a mkrootfs directory under your main project directory
  2. Download scripts.tar into mkrootfs directory and extract it into the mkrootfs directory
    • Three scripts (mkfhs.sh, mkext2.sh, config.sh) should reside directly within the mkrootfs directory
  3. Download etc.tar into mkrootfs directory and extract it as etc
  4. Download hwaddr.tar into mkrootfs' directory and extract it as hwaddr


At this point you should have the following directory and file structure under mkrootfs

  • mkrootfs
    • etc
    • hwaddr
    • config.sh
    • mkext2.sh
    • mkfhs.sh

Make Root File System Script

The mkfhs.sh script is used to create the directory structure and copy some configuration files from the provided etc directory. Looking into the script you will see it does quite a lot. Look into it to make sense out of each of the command line calls. The script relies on config.sh to be in the same directory. After running mkfhs.sh a new directory called rootfs is created. Verify this directory exists before continuing.

Using BusyBox

Download the latest stable release of BusyBox into the mkrootfs directory from: http://www.busybox.net

After downloading and extracting BusyBox change into the busybox-X.Y.Z directory. Since the executables BusyBox will compile will be run on the PowerPC 405 you will need to add a cross compiler to your PATH. In the RCS Lab we have setup CrossTools on Homer. To add the cross compiler tools run:

PATH=$PATH:/opt/crosstool/gcc-4.2.1-glibc-2.3.6/powerpc-405-linux-gnu/bin

Once the Cross Compiler is set you can setup BusyBox with the following commands:

  1. make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- defconfig
  2. make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- menuconfig
    • This opens a commandline menu, make the following changes:
      • BusyBox Settings --> Installation Options --> BusyBox Installation Prefix:
        • ../rootfs
  3. make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu-
    • Compiles the executables
  4. make ARCH=ppc CROSS_COMPILE=powerpc-405-linux-gnu- install
    • Copies the executables to the rootfs directory

Compiling and Installing inetutils

Until Ron finishes the Lab Root File System we can use rcp and rsh to access nodes over the network. Download inetutils from http://www.gnu.org/software/inetutils (as of this writing we are using version 1.5). Extract the archive into the mkrootfs directory. Download the My.makefile into the inetutils-1.5 directory. This makefile will configure inetutils, compile and install it to the rootfs/usr/bin directory.

To use My.makefile simply change directories to inetutils-1.5 and type:

make -f My.makefile

Make Compressed File System Script

The mkext2.sh script is used to create a compressed ram disk image to be combined with the compiled Linux kernel. The script modifies permissions, creates the device information (devinfo) table and uses genext2fs to generate the appropriate ram disk. The script relies on config.sh script to know the relative location of the linux-2.6-xlnx directory. The script will create ramdisk.image.gz which will be in the linux-2.6-xlnx/arch/ppc/boot/images directory. Even though you have not configured the Linux Kernel yet, this will copy the ramdisk to the correct location to be used in the future.


Continue on to the Creating a Hardware Base System for Linux 2.6 for the ML-410 Tutorial

Personal tools