#!/bin/sh
# Copyright (c) 2006, Technologic Systems.
# All rights reserved.
#
# Attempts to NFS root to 192.168.0.1:/tsarm-nfsroot
# Change as needed, symlink to /linuxrc, and run "save" to use

mount -t proc proc /proc

export CONSOLE=/dev/ttyAM0
ifconfig eth0 192.168.0.50
mount 192.168.0.1:/nfsroot /mnt/root >/dev/null 2>&1

export BOOTTIME=`eptime`
cd /proc
if [ -e /mnt/root/fastboot -o ! -e /mnt/root/bin/mount ]; then
  (
  export ENV=/shinit
  setcons
  cd /mnt/root
  telnetd
  exec sh -i
  ) <$CONSOLE >$CONSOLE 2>&1
  killall busybox
fi

cd /mnt/root

(
stty -F $CONSOLE ospeed 115200 >/dev/null 2>&1 
echo ">> Booting Linux..." 
setcons
) >$CONSOLE <$CONSOLE 2>&1

pivot_root . initrd
./bin/mount -n --move initrd/dev dev
./bin/mount -n --move initrd/proc proc
exec ./usr/sbin/chroot . /sbin/init <.$CONSOLE >.$CONSOLE 2>&1
