Root filesystems

From GumstixDocsWiki

Jump to: navigation, search

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Customers working with:

1/ The Gumstix Overo series or

2/ OpenEmbedded on the Verdex Pro series

should follow the instructions at gumstix.net and the related user wiki.


The instructions are for customers using buildroot, only.


Note: all gumstix verdex motherboards available at www.gumstix.com are pre-flashed with Linux and the OpenEmbedded build environment

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

For customers using buildroot:


This page describes alternatives to flashing your root filesystem into Gumstix flash.

Use Buildroot to create your filesystem.

Then deploy it on a CF, MMC, or NFS.

And boot it using U-Boot's script command. Refer to the U-Boot manual for details.

Working example - initramfs_boot.zip 3MB rootfs.zip 20MB

ext3 Working example - initramfs_boot_ext3.zip 3MB rootfs_ext3.zip 20MB

Note that CF and MMC cards are formatted with a FAT filesystem.
All you have to do is unzip the two zipped files (initramfs_boot and rootfs) onto a CF or MMC card.

Note that these working examples do a static ip address assignment of 192.168.1.61
You can loop mount rootfs.img to edit configuration files.


Contents

NFS Root

Requires a Linux NFS server. NFS Howto

U-Boot uses TFTP to load the kernel and then the kernel mounts its root filesystem using NFS. The root filesystem in flash isn't required at all.

Copy build_arm_nofpu/root to the exported directory on the NFS server

rm -rf /var/gum/*
cp -a build_arm_nofpu/root/* /var/gum/

Check that /var/gum/dev/console and /var/gum/dev/null exist. Make them if they don't exist

cd /var/gum/dev
mknod console c 5 1
mknod null c 1 3

Turn off the networking script since networking is no longer an inserted module

mv /var/gum/etc/init.d/S40network /var/gum/etc/init.d/s40network

Non-bluetooth systems boot faster with the bluetooth script turned off

mv /var/gum/etc/init.d/S30bluetooth /var/gum/etc/init.d/s30bluetooth

Skip the configuration reminder too

rm /var/gum/etc/motd

Edit fstab and comment out the mount of mtdblock1 on /

#/dev/mtdblock1 /               jffs2   rw,noatime              0       1

Requires CONFIG_ROOT_NFS and CONFIG_IP_PNP in the kernel. The easiest way to customize the kernel is to build the default first using buildroot and then recompile the linux kernel.

During this step:

make ARCH=arm menuconfig

make these selections

select networking
select networking options
change Unix domain sockets from M to *
under TCP/IP networking - select [*] IP: kernel level autoconfiguration

select Device drivers
select Network device support
select Ethernet (10 or 100Mbit)
change SMC 91C9x/91C1xxx support from M to *

select File systems
select Network File Systems
select <*> NFS File System Support
select [*] Provide NFSv3 client support
select [*] Root filesystem on NFS

If you want to keep these change in this buildroot

cp .config ../../target/device/Gumstix/basix-connex/linux.config

Now build the NFS enabled kernel

make ARCH=arm clean
rm build_arm_nofpu/root/boot/uImage

from your gumstix-buildroot

cd <gumstix-buildroot>
make

the new kernel is in build_arm_nofpu/root/boot/uImage
copy the kernel to your tftpboot directory

cp ./build_arm_nofpu/root/boot/uImage /tftpboot

The new kernel can be loaded with tftpboot using this (NFS version) gumstix-factory.script

echo "Booting Development System..."
set workedok Failed
if pinit on; then
       setenv serverip 192.168.1.101
       setenv ipaddr 192.168.1.61
       setenv bootargs console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=192.168.1.101:/var/gum,nolock ip=192.168.1.61:192.168.1.101:::::off
       if tftpb a2000000 uImage; then
          bootm a2000000
          set workedok Success
       fi
fi

NFS version of gumstix-factory.script you'll have to use these IP addresses, or create your own gumstix-factory.script.

Modify these U-Boot environment variables to boot from the network without using a gumstix-factory.script.

setenv bootargs 'console=ttyS0,115200n8 root=/dev/nfs rw nfsroot=192.168.1.101:/var/gum,nolock ip=192.168.1.61:192.168.1.101:::::off\; tftpb a2000000 uImage && bootm a2000000'
setenv bootcmdbackup 'icache on;setenv stderr nulldev; setenv stdout nulldev; if mmcinit && fatload mmc 0 a2000000 gumstix-factory.script; then setenv stdout serial; setenv stderr serial; echo Found gumstix-factory script...; autoscr; else setenv stdout serial;setenv stderr serial;fsload && bootm; fi'
setenv bootcmd 'tftpb a2000000 uImage\; bootm a2000000'
setenv serverip 192.168.1.101
setenv ipaddr 192.168.1.61
saveenv

initramfs Root (CF/MMC)

initramfs is used to set up the loop mounted image from MMC or CF instead of changing the jffs2 flash root filesystem. The goal is to load the kernel from MMC or CF and then load an initial root filesystem from MMC or CF that mounts at / on a ramfs. This root filesystem can be your system's root filesystem, or it can be used to load the final root filesystem from an image on MMC or CF.

The root filesystem in flash isn't required at all.

Boot messages should include this line:

checking if image is initramfs... it is

Here is a my-gumstix-factory.script that loads the initramfs from MMC or CF and tells the initial root filesystem what media it booted :

# u-boot script
# tests for mmc card presence to determine if booting from mmc or cf
# so we can set the command line accordingly.
# the command line is used by initramfs' /init script to load the
# correct set of modules

# if neither mmc or cf exist, then boot the flash file system from jffs2


if mmcinit; then
   setenv bootargs rw console=ttyS0,115200n8 reboot=cold,hard MEDIA=MMC
   fatload mmc 0 a1000000 uImage; && fatload mmc 0 a2000000 ramdisk.img
else
   if pinit on; then
      setenv bootargs rw console=ttyS0,115200n8 reboot=cold,hard MEDIA=CF
      fatload ide 0 a1000000 uImage; && fatload ide 0 a2000000 ramdisk.img
   else
        setenv bootargs root=1f01 rootfstype=jffs2 console=ttyS0,115200n8 reboot=cold,hard
	fsload && bootm
   fi
fi

bootm a1000000 a2000000

Note: if you want to boot directly to a shell in your initramfs, add rdinit=/bin/sh to the boot args above like:

setenv bootargs root=/dev/ram0 rw console=ttyS0,115200n8 reboot=cold,hard rdinit=/bin/sh

Once you have modified your my-gumstix-factory.script accordingly, you need to make that into a uboot image (which pretty much prepends a header):

 ./build_arm_nofpu/staging_dir/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n gumstix-factory.script -d my-gumstix-factory.script gumstix-factory.script

Copy the resultant gumstix-factory.script to your CF or MMC card

Using buildroot to build an initramfs image

After make defconfig, run make menuconfig.

In package selection for the target,
leave "The default minimal system" selected

  • Busybox
  • Install symlinks for BusyBox applets

turn off everything in "Other stuff" except

  • udev
  • pxaregs
  • pcmciautils
  • module-init-tools
  • libsysfs

In target options,turn off everything

Enable drivers required in the kernel

The easiest way to customize the kernel is to build the default first using buildroot and then recompile the linux kernel.

During this step (in the kernel source directory):

make ARCH=arm menuconfig

make these selections:

 General setup ->
   [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support
 Boot Options ->
   Default kernel command string ->
     console=ttyS0,115200n8
 Device Drivers ->
   Block devices ->
     <*> Loopback device support
     <*> RAM disk support
     (16)  Default number of RAM disks
     (4096) Default RAM disk size (kbytes)
     (1024) Default RAM disk block size (bytes)
 File systems ->
   <*> Second extended fs support
   <*> Ext3 journalling file system support
   [*] Ext3 extended attributes

If you want to keep these changes in this buildroot

cp .config ../../target/device/Gumstix/basix-connex/linux.config

Now build the initramfs enabled kernel

make ARCH=arm clean

from your gumstix-buildroot

cd <gumstix-builtroot>
make

the new kernel is in build_arm_nofpu/linux-${kernelver}/arch/arm/boot/uImage copy the kernel to your CF or MMC card

Busybox config

cd gumstix-buildroot/build_arm_nofpu/busybox-1.1.2
make ARCH=arm menuconfig

Add switch_root to busybox in Linux System Utilities

Add e2fsck to busybox in Linux Ext2 FS Progs

cd gumstix-buildroot
rm build_arm_nofpu/root/bin/busybox
make

Prepare the initramfs image

create /init :

The initramfs requires a file named 'init' in /

Create gumstix-buildroot/build_arm_nofpu/root/init

This /init loads the correct modules for CF or MMC and then loop mounts the ext2 filesystem image from the card. The determination of MMC vs CF is made by the gumstix-factory.script that is run by U-Boot and passed to linux as a kernel argument.

#!/bin/sh
# initramfs /init

die()
{
	echo ""
	echo "/init failed: $*"
	echo ""
	echo "ERROR! Dropping to a shell so you can figure it out"	
	exec /bin/sh
	exit 0
}

find_module()
{
	find /lib/modules -name "$1" | grep "$1" > /dev/null 2>&1
	return $?
}

load_module()
{
	if find_module "$1.ko" ; then
		echo -n " [*] loading $1 module..."
		modprobe $1 || die "failed to load $1"
		echo "done"
	fi
}

echo "/init script running..."

echo -n " [*] populating /dev..."
/sbin/udevstart || die "failed to populate /dev with /sbin/udevstart"
if [ ! -d /dev/pts ] ; then
	mkdir /dev/pts || die "failed to mkdir /dev/pts"
fi
if [ ! -d /dev/shm ] ; then
	mkdir /dev/shm || die "failed to mkdir /dev/shm"
fi
mount /dev/pts || die "failed to mount /dev/pts"
echo "done"

echo -n " [*] mounting /proc..."
mount -t proc proc /proc || die "failed to mount /proc"
echo "done"

echo -n " [*] mounting /sys..."
mount -t sysfs sysfs /sys || die "failed to mount /sys"
echo "done"

load_module "smc91x"

echo -n " [*] starting udevd..."
/sbin/udevd &
udevd_pid=$!
echo "done"

# figure out if the system booted with CF or MMC
# use awk, expect the last kernel arg to tell us
result=`cat /proc/cmdline | awk '{print $NF}'`

if [ "$result" = "MEDIA=MMC" ] ; then
	echo " [*] Found MEDIA=MMC"
	load_module "mmc_block"
	load_module "pxamci"

	sleep 2
	MOUNT_DIR=/mnt/mmc
	mount /dev/mmcblk0p1 $MOUNT_DIR || die "failed to mount SD"
elif [ "$result" = "MEDIA=CF" ] ; then
	echo " [*] Found MEDIA=CF"
	load_module pcmcia
	load_module ide-cs
	load_module ide-disk

	MOUNT_DIR=/mnt/cf

	# Wait for device to be detected... (max 5 secs)
	i=0
	while ! [ -f /proc/ide/ide0/hda/media ] ; do
		/sbin/udevtrigger || die "udevtrigger failed"
		sleep 1
		if [ "$i" = "5" ] ; then
			die "too long waiting on CF card to register"
		fi
		i=`expr $i + 1`
	done

	mount -t vfat /dev/hda1 $MOUNT_DIR || die "failed to mount CF"
fi

if [ ! -f "$MOUNT_DIR/rootfs.img" ] ; then
	die "$MOUNT_DIR/rootfs.img does not exist"
fi

echo -n " [*] running e2fsck on $MOUNT_DIR/rootfs.img..."
/sbin/e2fsck -y $MOUNT_DIR/rootfs.img
echo "done"

echo -n " [*] mounting $MOUNT_DIR/rootfs.img to /rfs..."
mount -t ext2 -o loop -o rw $MOUNT_DIR/rootfs.img /rfs || die "failed to mount /rfs"
echo "done"

echo -n " [*] Cleaning up..."
# Clean up
kill $udevd_pid
umount -l /proc
umount -l /sys
umount -l /dev/pts
echo "done"

# Switch Root
echo " [*] Switching to real root fs..."
exec switch_root /rfs /sbin/init

#shouldn't get here!
die "switch_root must have failed"

Make /init executable

chmod +x /init
Create devices required at boot

mknod in root/dev or cp -a from the host /dev, or untar in root/dev:

crw-rw---- 1 root root 5,  1 2006-11-08 16:52 console
brw-rw---- 1 root root 3,  0 2006-11-08 22:31 hda
brw-rw---- 1 root root 3,  1 2004-02-23 13:02 hda1
lrwxrwxrwx 1 root root     8 2006-11-09 12:00 log -> /tmp/log
brw-rw---- 1 root root 7,  0 2004-02-23 13:02 loop0
brw-rw---- 1 root root 7,  1 2004-02-23 13:02 loop1
brw-rw---- 1 root root 7,  2 2004-02-23 13:02 loop2
brw-rw---- 1 root root 7,  3 2004-02-23 13:02 loop3
brw-rw---- 1 root root 254,  0 2006-11-10 19:15 mmcblk0
brw-rw---- 1 root root 254,  1 2006-11-10 19:15 mmcblk0p1
crw-rw-rw- 1 root root 1,  3 2006-11-08 16:54 null
drwxr-xr-x 2 root root  4096 2002-04-15 07:32 pts
brw-rw---- 1 root root 1,  0 2006-11-08 16:51 ram0
brw-rw---- 1 root root 1,  1 2006-11-08 16:48 ram1
crw-rw---- 1 root root 4, 64 2004-02-23 13:02 ttyS0
crw-rw-rw- 1 root root 1,  5 2006-11-08 16:54 zero

Devices that are used in the initial root file system must exist in the new root file system for switch_root to work.

Something like this might also work to generate the device nodes (as root):

cd root/dev
rm -rf *
mknod -m 0660 console   c 5 1
mknod -m 0660 full      c 1 7
mknod -m 0660 hda       b 3 0
mknod -m 0660 hda1      b 3 1
mknod -m 0660 kmem      c 1 2
mknod -m 0660 kmsg      c 1 11
mknod -m 0660 mem       c 1 1
mknod -m 0660 loop0     b 7 0
mknod -m 0660 loop1     b 7 1
mknod -m 0660 loop2     b 7 2
mknod -m 0660 loop3     b 7 3
mknod -m 0660 mmcblk0   b 254 0
mknod -m 0660 mmcblk0p1 b 254 1
mknod -m 0666 null      c 1 3
mknod -m 0660 ram0      b 1 0
mknod -m 0660 ram1      b 1 1
mknod -m 0660 random    c 1 8
mknod -m 0660 tty       c 5 0
mknod -m 0660 ttyS0     c 4 64
mknod -m 0660 urandom   c 1 9
mknod -m 0666 zero      c 1 5
mkdir pts
mkdir shm
chmod 755 pts shm
ln -sf /tmp/log log
Create directories for mounting the new root filesystem image
mkdir root/rfs
mkdir root/mnt/cf


Generate the initramfs image

mkinitramfs.sh

#!/bin/sh
if [ $# -ne 2 ]
then
  echo "usage: mkinitramfs directory imagename.cpio.gz"
  exit 1
fi

if [ -d "$1" ]
then
  echo "creating $2 from $1"
  (cd "$1"; find . | cpio -o -H newc | gzip) > "$2"
  ./build_arm_nofpu/staging_dir/bin/mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n rootfs -d $2 ramdisk.img
else
  echo "First argument must be a directory"
  exit 1
fi

run mkinitramfs.sh from /gumstix-buildroot

./mkinitramfs.sh ./build_arm_nofpu/root/ rootfs.cpio.gz

(the rootfs.cpio.gz seems to be unused after this point, use the generated ramdisk.img)

then copy ramdisk.img and uImage to /tftpboot/ or to MMC or CF card

cp ./ramdisk.img /tftpboot/
cp ./build_arm_nofpu/root/boot/uImage /tftpboot/

Creating a filesystem image from the buildroot

make these changes to files in build_arm_nofpu/root/

Modify fstab, inittab, and rc.modules

fstab and inittab need to be modified on the file system image on CF or MMC so that startup and shutdown handle mounts correctly.

Green lines are new. Red lines are commented out.

etc/fstab

# /etc/fstab: static file system information.
#
# <file system> <mount pt>     <type>   <options>         <dump> <pass>
#/dev/mtdblock1 /               jffs2   rw,noatime              0       1
/dev/loop0      /               ext2    rw,noatime              0       1
proc            /proc           proc    defaults                0       0
sysfs           /sys            sysfs   defaults                0       0
# devpts is noauto because it needs to mount *after* udev starts
devpts          /dev/pts        devpts  gid=5,mode=620,noauto   0       0
tmpfs           /tmp            tmpfs   mode=1777               0       0
/dev/mmcblk0p1  /mnt/mmc        vfat    sync,noauto             0       0
/dev/hda1       /mnt/cf         vfat    sync,noauto             0       0

etc/inittab

# Startup the system
#null::sysinit:/bin/mount -o remount,rw /
null::sysinit:/sbin/depmod -a
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/etc/init.d/rc.udev start
null::sysinit:/etc/init.d/rc.modules start
null::sysinit:/bin/mount -a
null::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS start

# Put a getty on the serial port
::respawn:/sbin/getty -L ttyS0 115200 vt100

# Logging junk
null::sysinit:/bin/touch /var/log/messages
null::respawn:/sbin/syslogd -n -m 0
null::respawn:/sbin/klogd -n

# Stuff to do before rebooting
::shutdown:/etc/init.d/rcS stop
null::shutdown:/usr/bin/killall klogd
null::shutdown:/usr/bin/killall syslogd
null::shutdown:/bin/umount -a -r
null::shutdown:/bin/umount -l /

etc/init.d/rc.modules

#!/bin/sh
PATH="/sbin:/bin:/usr/bin"

result=`cat /proc/cmdline | awk '{print $NF}'`

# MMC support --
if [ $result = "MEDIA=MMC" ]; then
(cp /etc/modules-mmc /etc/modules)
fi

# CF support --
if [ $result = "MEDIA=CF" ]; then
(cp /etc/modules-cf /etc/modules)
fi

echo -n 'Loading modules: '
(cat /etc/modules; echo) | while read module args
do
        case "$module" in
                \#*|"") continue ;;
        esac
        echo -n "$module "
        modprobe $module $args
done
echo ": Loaded."
exit 0

create modules-mmc and modules-cf

cp etc/modules etc/modules-mmc
cp etc/modules etc/modules-cf

edit modules-mmc

loop

# MMC support -- uncomment the next two lines to enable MMC if not using CF
mmc_block
pxamci

# Compact Flash support -- comment next line to disable CF if using MMC
#pcmcia

edit modules-cf

loop

# MMC support -- uncomment the next two lines to enable MMC if not using CF
#mmc_block
#pxamci

# Compact Flash support -- comment next line to disable MMC if using CF
pcmcia
Generate the image

make build_arm_nofpu your working directory

 cd build_arm_nofpu

create a place to mount the filesystem

 mkdir tmp/fsimage

create a blank filesystem image

 mkdir images
 dd if=/dev/zero of=images/rootfs.img bs=1k count=65536

create a filesystem on the image

 /sbin/mke2fs -F -v -m0 images/rootfs.img

mount the image

 mount -o loop images/rootfs.img tmp/fsimage

copy the root filesystem to the image

 cp -av root/* tmp/fsimage

done, unmount the image

 umount tmp/fsimage

Alternative to rootfs image

It is possible and sometime desirable to have the root filesystem not as an image but directly on the mmc. The image is very inconvenient since it is predefined in size, thus it's not always easy to use as much space as possible on the card. An ext2 filesystem on the card would solve those issues.

The card is partitioned like this:
/dev/mmcblk0p1
/dev/mmcblk0p2

mmcblk0p1 contains a FAT filesystem since u-boot cannot read ext2 (at least mine). uImage, ramdisk.img, and gumstix-factory.script will be located here.
mmcblk0p2 contains an ext2 filesystem which corresponds to the root /.

The ramdisk's init file needs to be modified to accomodate the changes:

#!/bin/sh
# initramfs /init

die()
{
	echo ""
	echo "/init failed: $*"
	echo ""
	echo "ERROR! Dropping to a shell so you can figure it out"	
	exec /bin/sh
	exit 0
}

find_module()
{
	find /lib/modules -name "$1" | grep "$1" > /dev/null 2>&1
	return $?
}

load_module()
{
	if find_module "$1.ko" ; then
		echo -n " [*] loading $1 module..."
		modprobe $1 || die "failed to load $1"
		echo "done"
	fi
}

echo "/init script running..."

echo -n " [*] populating /dev..."
/sbin/udevstart || die "failed to populate /dev with /sbin/udevstart"
if [ ! -d /dev/pts ] ; then
	mkdir /dev/pts || die "failed to mkdir /dev/pts"
fi
if [ ! -d /dev/shm ] ; then
	mkdir /dev/shm || die "failed to mkdir /dev/shm"
fi
mount /dev/pts || die "failed to mount /dev/pts"
echo "done"

echo -n " [*] mounting /proc..."
mount -t proc proc /proc || die "failed to mount /proc"
echo "done"

echo -n " [*] mounting /sys..."
mount -t sysfs sysfs /sys || die "failed to mount /sys"
echo "done"

echo -n " [*] starting udevd..."
/sbin/udevd &
udevd_pid=$!
echo "done"

# figure out if the system booted with CF or MMC
# use awk, expect the last kernel arg to tell us
result=`cat /proc/cmdline | awk '{print $NF}'`
 
if [ "$result" = "MEDIA=MMC" ] ; then
	echo " [*] Found MEDIA=MMC"
	load_module "mmc_block"
	load_module "pxamci"

	sleep 2
	MOUNT_DIR=/mnt/mmc
	umount /mnt/mmc
	mount /dev/mmcblk0p1 $MOUNT_DIR || die "failed to mount SD"
elif [ "$result" = "MEDIA=CF" ] ; then
	echo " [*] Found MEDIA=CF"
	load_module pcmcia
	load_module ide-cs
	load_module ide-disk

	MOUNT_DIR=/mnt/cf

	# Wait for device to be detected... (max 5 secs)
	i=0
	while ! [ -f /proc/ide/ide0/hda/media ] ; do
		/sbin/udevtrigger || die "udevtrigger failed"
		sleep 1
		if [ "$i" = "5" ] ; then
			die "too long waiting on CF card to register"
		fi
		i=`expr $i + 1`
	done

	mount -t vfat /dev/hda1 $MOUNT_DIR || die "failed to mount CF"
fi

if [ -f "$MOUNT_DIR/rootfs.img" ] ; then

echo -n " [*] running e2fsck on $MOUNT_DIR/rootfs.img..."
/sbin/e2fsck -y $MOUNT_DIR/rootfs.img
echo "done"

echo -n " [*] mounting $MOUNT_DIR/rootfs.img to /rfs..."
mount -t ext2 -o loop -o rw $MOUNT_DIR/rootfs.img /rfs || die "failed to mount /rfs"
echo "done"

else

echo -n " [*] running e2fsck on /dev/mmcblk0p2..."
/sbin/e2fsck -y /dev/mmcblk0p2
echo "done"

echo -n " [*] mounting /dev/mmcblk0p2 to /rfs..."
mount -t ext2 -o rw /dev/mmcblk0p2 /rfs || die "failed to mount /rfs"
echo "done"

fi

echo -n " [*] Cleaning up..."
# Clean up
kill $udevd_pid
umount -l /proc
umount -l /sys
umount -l /dev/pts
echo "done"

# Switch Root
echo " [*] Switching to real root fs..."
exec switch_root /rfs /sbin/init

#shouldn't get here!
die "switch_root must have failed"

When you are done building the initramfs and before building the rootfs image transfer the newly built ramdisk to the first partition of the card. Then inside buildroot:

create a place to mount the filesystem

 mkdir uSD

mount the ext2 partition

 mount -t ext2 -o rw /dev/mmcblk0p2 ./uSD

copy the root filesystem to the card

 cp -av ./build_arm_nofpu/root/* ./uSD

done, unmount the image

 umount ./uSD

It is not necessary to build the rootfs image then. If the init script does not find rootfs.img on the first partition it will try to use the ext2 filesystem on the second partition. Now the only limitation is the card size not the image size, useful to avoid the copy of ~400MB of 0 when using a 512MB card.

Using the MMC Card as the Root Filesystem

The original directions required changes to the flash filesystem and required running scripts on the flash filesystem and on the target filesystem to get the new root filesystem running.

  • Create a root filesystem image from buildroot

rootfs.img directions.

Copy images/rootfs.img to your MMC card.

Using the CompactFlash Card as the Root Filesystem

The original directions required changes to the flash filesystem and required running scripts on the flash filesystem and on the target filesystem to get the new root filesystem running.


Loading images from CompactFlash requires the U-Boot pinit command. This was added in U-Boot 1.1.4-r1066.

  • Change U-Boot's bootcmd

CF requires a different U-Boot bootcmd environment variable.

The bootcmd shown in this step is the default bootcmd in U-Boot 1.1.4-r1161, so the easiest way to do this is to flash a new U-Boot from SourceForge.

Change the bootcmd from U-Boot:

GUM> setenv bootcmd 'icache on\; setenv stderr nulldev\; setenv stdout nulldev\; 
if pinit on && fatload ide 0 a2000000 gumstix-factory.script\; 
then setenv stdout serial\; setenv stderr serial\; echo Found gumstix-factory.script...\; autoscr\; 
else if mmcinit && fatload mmc 0 a2000000 gumstix-factory.script\; 
then setenv stdout serial\; setenv stderr serial\; echo Found gumstix-factory.script...\; autoscr\; 
else setenv stdout serial\; setenv stderr serial\; fsload && bootm\; fi\; fi'

This bootcmd needs to be entered as one line.


If the root filesystem on your gumstix was compiled with the 1.1.4 version of U-Boot, then you can change U-Boot's bootcmd from Linux. Check the version compatibility first by running fw_printenv.

To change the bootcmd from Linux:

# fw_setenv bootcmd 'icache on; setenv stderr nulldev; setenv stdout nulldev;
if pinit on && fatload ide 0 a2000000 gumstix-factory.script; then setenv stdout serial; 
setenv stderr serial; echo Found gumstix-factory.script...; autoscr; 
else if mmcinit && fatload mmc 0 a2000000 gumstix-factory.script; 
then setenv stdout serial; setenv stderr serial; echo Found gumstix-factory.script...;
autoscr; else setenv stdout serial; setenv stderr serial; fsload && bootm;
fi; fi'

This bootcmd needs to be entered as one line. Note that fw_setenv doesn't require ';' to be escaped with a '\'. update_bootcmd.sh

  • Create a root filesystem image from buildroot

rootfs.img directions.

Copy images/rootfs.img to your CF card.

Personal tools