Commit a2bd5567 authored by Mike Hibler's avatar Mike Hibler

Some of the files that went into the Moonshot frisbee MFS.

parent 0b324bcd
setenv bootargs "console=ttyS0,${baudrate}n8r ro root=/dev/sda2"
load scsi 0 ${kernel_addr_r} uImage
load scsi 0 ${ramdisk_addr_r} uInitrd
bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
Pieces that go into an HP Moonshot ARMv8 cartridge initrd that serves
as the "frisbee MFS".
rc.frisbee
Installed as usr/local/etc/emulab/rc.frisbee in initrd.
This is the main frisbee driver fired off by the initrd "init" script.
slicefix
Installed as usr/local/etc/emulab/slicefix in initrd.
Called by rc.frisbee to fixup filesystems after imaging.
init
Installed as init in initrd.
This is a modified version of the standard script run when the
initrd boots.
initramfs.conf
Installed as initrd.conf/initramfs.conf in initrd.
Modifies the default boot parameters used by the init script.
udev
Installed as scripts/init-bottom/udev in initrd.
Modified version of the original to account for there being no
separate $rootmnt.
hosts
Installed as etc/hosts in initrd.
Just a localized copy with boss, ops, etc. Could be generated.
mfs
Installed as sripts/mfs in initrd.
New script analogous to "local" and "nfs".
nsswitch.conf
Installed as etc/nsswitch.conf in initrd.
Localized version.
Directories made in initrd filesystem:
/dev
/etc/emulab
/images
/mnt
/proc
/root
/sys
/usr
/usr/{bin,sbin}
/usr/{lib,lib/aarch64-linux-gnu}
/usr/{local,local/etc,local/etc/emulab}
/var
/var/emulab
/var/emulab/{boot,logs,lock,db}
Empty files created:
/etc/mtab
Other binaries/libraries/files copied in from an Ubuntu 14.04 image:
/bin/bash
/etc/localtime
/etc/protocols
/etc/services
/lib/aarch64-linux-gnu/libcap.so.2
/lib/aarch64-linux-gnu/libcrypto.so.1.0.0
/lib/aarch64-linux-gnu/libgcc_s.so.1
/lib/aarch64-linux-gnu/libnsl-2.19.so
/lib/aarch64-linux-gnu/libnsl.so.1
/lib/aarch64-linux-gnu/libnss_dns-2.19.so
/lib/aarch64-linux-gnu/libnss_dns.so.2
/lib/aarch64-linux-gnu/libnss_files-2.19.so
/lib/aarch64-linux-gnu/libnss_files.so.2
/lib/aarch64-linux-gnu/libprocps.so.3
/lib/aarch64-linux-gnu/libresolv-2.19.so
/lib/aarch64-linux-gnu/libresolv.so.2
/lib/aarch64-linux-gnu/libtinfo.so.5
/lib/aarch64-linux-gnu/libz.so.1
/sbin/e2fsck
/sbin/sgdisk
/sbin/sysctl
/sbin/tune2fs
/usr/bin/free
/usr/lib/aarch64-linux-gnu/libicudata.so.52
/usr/lib/aarch64-linux-gnu/libicui18n.so.52
/usr/lib/aarch64-linux-gnu/libicuio.so.52
/usr/lib/aarch64-linux-gnu/libicuuc.so.52
/usr/lib/aarch64-linux-gnu/libstdc++.so.6
/usr/sbin/ntpdate
# optional
/bin/ping # for debugging
/sbin/depmod # if you add/remove modules
/usr/bin/strace # for debugging
Emulab content copied in:
/etc/emulab/
client.pem # from boss:/usr/testbed/etc
emulab.pem # from boss:/usr/testbed/etc
gpt1.img # as generated by "sgdisk -b" from a working image
paths.sh # standard
/etc/ntp.conf
/etc/ssh
/etc/resolv.conf
/root/.ssh
/usr/local/etc/emulab/
findif # standard client build
freebsd_to_linux_disk # from clientside/tmcc/linux/
frisbee # standard client build
imageunzip # standard client build
localize_image # from clientside/tmcc/common/
rc.frisbee # from here
slicefix # from here
tmcc # standard client build (tmcc.nossl)
Note that the current MFS is using a 3.13.11.10 kernel that I got from
Mik Stearns at HP because it had NFS root support that the standard Ubuntu
kernel did not. That kernel should not be needed for this MFS, but what
the heck!
I also removed a bunch of drivers from /lib/modules/*/kernel. I took out
all of the net/ethernet drivers except the mellanox ones. Took out a bunch
of the scsi drivers too. Many, many more could be pruned, I just took out the
easy big ones.
127.0.0.1 localhost
128.110.156.4 boss.utah.cloudlab.us boss
128.110.156.34 ops.utah.cloudlab.us ops fs users ntp1
#!/bin/sh
[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
[ -d /proc ] || mkdir /proc
[ -d /tmp ] || mkdir /tmp
mkdir -p /var/lock
mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
mount -t proc -o nodev,noexec,nosuid proc /proc
# Some things don't work properly without /etc/mtab.
ln -sf /proc/mounts /etc/mtab
grep -q '\<quiet\>' /proc/cmdline || echo "Loading, please wait..."
# Note that this only becomes /dev on the real filesystem if udev's scripts
# are used; which they will be, but it's worth pointing out
if ! mount -t devtmpfs -o mode=0755 udev /dev; then
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
mount -t tmpfs -o mode=0755 udev /dev
[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
[ -e /dev/null ] || mknod /dev/null c 1 3
fi
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
mount -t tmpfs -o "noexec,nosuid,size=10%,mode=0755" tmpfs /run
mkdir /run/initramfs
# compatibility symlink for the pre-oneiric locations
ln -s /run/initramfs /dev/.initramfs
# Export the dpkg architecture
export DPKG_ARCH=
. /conf/arch.conf
# Set modprobe env
export MODPROBE_OPTIONS="-qb"
# Export relevant variables
export ROOT=
export ROOTDELAY=
export ROOTFLAGS=
export ROOTFSTYPE=
export IP=
export BOOT=
export BOOTIF=
export UBIMTD=
export break=
export init=/usr/local/etc/emulab/rc.frisbee
export quiet=n
export readonly=y
export rootmnt=/
export debug=
export panic=
export blacklist=
export resume=
export resume_offset=
export recovery=
# mdadm needs hostname to be set. This has to be done before the udev rules are called!
if [ -f "/etc/hostname" ]; then
/bin/hostname -b -F /etc/hostname 2>&1 1>/dev/null
fi
# Bring in the main config
. /conf/initramfs.conf
for conf in conf/conf.d/*; do
[ -f ${conf} ] && . ${conf}
done
. /scripts/functions
# Parse command line options
for x in $(cat /proc/cmdline); do
case $x in
init=*)
init=${x#init=}
;;
root=*)
ROOT=${x#root=}
case $ROOT in
LABEL=*)
ROOT="${ROOT#LABEL=}"
# support any / in LABEL= path (escape to \x2f)
case "${ROOT}" in
*/*)
if command -v sed >/dev/null 2>&1; then
ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')"
else
if [ "${ROOT}" != "${ROOT#/}" ]; then
ROOT="\x2f${ROOT#/}"
fi
if [ "${ROOT}" != "${ROOT%/}" ]; then
ROOT="${ROOT%/}\x2f"
fi
IFS='/'
newroot=
for s in $ROOT; do
newroot="${newroot:+${newroot}\\x2f}${s}"
done
unset IFS
ROOT="${newroot}"
fi
esac
ROOT="/dev/disk/by-label/${ROOT}"
;;
UUID=*)
ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
;;
/dev/nfs)
[ -z "${BOOT}" ] && BOOT=nfs
;;
esac
;;
rootflags=*)
ROOTFLAGS="-o ${x#rootflags=}"
;;
rootfstype=*)
ROOTFSTYPE="${x#rootfstype=}"
;;
rootdelay=*)
ROOTDELAY="${x#rootdelay=}"
case ${ROOTDELAY} in
*[![:digit:].]*)
ROOTDELAY=
;;
esac
;;
resumedelay=*)
RESUMEDELAY="${x#resumedelay=}"
;;
loop=*)
LOOP="${x#loop=}"
;;
loopflags=*)
LOOPFLAGS="-o ${x#loopflags=}"
;;
loopfstype=*)
LOOPFSTYPE="${x#loopfstype=}"
;;
cryptopts=*)
cryptopts="${x#cryptopts=}"
;;
nfsroot=*)
NFSROOT="${x#nfsroot=}"
;;
netboot=*)
NETBOOT="${x#netboot=}"
;;
ip=*)
IP="${x#ip=}"
;;
boot=*)
BOOT=${x#boot=}
;;
ubi.mtd=*)
UBIMTD=${x#ubi.mtd=}
;;
resume=*)
RESUME="${x#resume=}"
;;
resume_offset=*)
resume_offset="${x#resume_offset=}"
;;
noresume)
noresume=y
;;
panic=*)
panic="${x#panic=}"
case ${panic} in
*[![:digit:].]*)
panic=
;;
esac
;;
quiet)
quiet=y
;;
ro)
readonly=y
;;
rw)
readonly=n
;;
debug)
debug=y
quiet=n
exec >/run/initramfs/initramfs.debug 2>&1
set -x
;;
debug=*)
debug=y
quiet=n
set -x
;;
break=*)
break=${x#break=}
;;
break)
break=premount
;;
blacklist=*)
blacklist=${x#blacklist=}
;;
netconsole=*)
netconsole=${x#netconsole=}
;;
BOOTIF=*)
BOOTIF=${x#BOOTIF=}
;;
hwaddr=*)
BOOTIF=${x#BOOTIF=}
;;
recovery)
recovery=y
;;
esac
done
if [ -n "${noresume}" ]; then
export noresume
unset resume
else
resume=${RESUME:-}
fi
maybe_break top
# export BOOT variable value for compcache,
# so we know if we run from casper
export BOOT
# Don't do log messages here to avoid confusing graphical boots
run_scripts /scripts/init-top
maybe_break modules
[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
load_modules
[ "$quiet" != "y" ] && log_end_msg
[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
maybe_break premount
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
run_scripts /scripts/init-premount
[ "$quiet" != "y" ] && log_end_msg
maybe_break mount
log_begin_msg "Mounting root file system"
. /scripts/${BOOT}
parse_numeric ${ROOT}
maybe_break mountroot
mountroot
log_end_msg
maybe_break bottom
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
run_scripts /scripts/init-bottom
[ "$quiet" != "y" ] && log_end_msg
validate_init() {
checktarget="${1}"
# Work around absolute symlinks
if [ -d "${rootmnt}" ] && [ -h "${rootmnt}${checktarget}" ]; then
case $(readlink "${rootmnt}${checktarget}") in /*)
checktarget="$(chroot ${rootmnt} readlink ${checktarget})"
;;
esac
fi
# Make sure the specified init can be executed
if [ ! -x "${rootmnt}${checktarget}" ]; then
return 1
fi
# Upstart uses /etc/init as configuration directory :-/
if [ -d "${rootmnt}${checktarget}" ]; then
return 1
fi
}
# Check init bootarg
if [ -n "${init}" ]; then
if ! validate_init "$init"; then
echo "Target filesystem doesn't have requested ${init}."
init=
fi
fi
# Common case: /sbin/init is present
if [ ! -x "${rootmnt}/sbin/init" ]; then
# ... if it's not available search for valid init
if [ -z "${init}" ] ; then
for inittest in /sbin/init /etc/init /bin/init /bin/sh; do
if validate_init "${inittest}"; then
init="$inittest"
break
fi
done
fi
# No init on rootmount
if ! validate_init "${init}" ; then
panic "No init found. Try passing init= bootarg."
fi
fi
maybe_break init
export MFS_DEBUG=$debug
# don't leak too much of env - some init(8) don't clear it
# (keep init, rootmnt)
unset debug
unset MODPROBE_OPTIONS
unset DPKG_ARCH
unset ROOTFLAGS
unset ROOTFSTYPE
unset ROOTDELAY
unset ROOT
unset IP
unset BOOT
unset BOOTIF
unset UBIMTD
unset blacklist
unset break
unset noresume
unset panic
unset quiet
unset readonly
unset resume
unset resume_offset
${init} "$@" </dev/console >/dev/console 2>&1
if [ $? -ne 0 ]; then
panic "${init} failed, dropping to shell."
fi
exit 0
#
# initramfs.conf
# Configuration file for mkinitramfs(8). See initramfs.conf(5).
#
# Note that configuration options from this file can be overridden
# by config files in the /etc/initramfs-tools/conf.d directory.
#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add most filesystem and all harddrive drivers.
#
# dep - Try and guess which modules to load.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# list - Only include modules from the 'additional modules' list
#
MODULES=netboot
#
# BUSYBOX: [ y | n ]
#
# Use busybox if available.
#
BUSYBOX=y
#
# COMPCACHE_SIZE: [ "x K" | "x M" | "x G" | "x %" ]
#
# Amount of RAM to use for RAM-based compressed swap space.
#
# An empty value - compcache isn't used, or added to the initramfs at all.
# An integer and K (e.g. 65536 K) - use a number of kilobytes.
# An integer and M (e.g. 256 M) - use a number of megabytes.
# An integer and G (e.g. 1 G) - use a number of gigabytes.
# An integer and % (e.g. 50 %) - use a percentage of the amount of RAM.
#
# You can optionally install the compcache package to configure this setting
# via debconf and have userspace scripts to load and unload compcache.
#
COMPCACHE_SIZE=""
#
# COMPRESS: [ gzip | bzip2 | lzma | lzop | xz ]
#
COMPRESS=gzip
#
# NFS Section of the config.
#
#
# BOOT: [ local | nfs ]
#
# local - Boot off of local media (harddrive, USB stick).
#
# nfs - Boot using an NFS drive as the root of the drive.
#
BOOT=mfs
#
# DEVICE: ...
#
# Specify a specific network interface, like eth0
# Overridden by optional ip= bootarg
#
DEVICE=eth0
#
# NFSROOT: [ auto | HOST:MOUNT ]
#
NFSROOT=auto
# MFS filesystem mounting, do nothing -*- shell-script -*-
pre_mountroot()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/mfs-top"
run_scripts /scripts/mfs-top
[ "$quiet" != "y" ] && log_end_msg
}
mountroot()
{
pre_mountroot
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/mfs-premount"
run_scripts /scripts/mfs-premount
[ "$quiet" != "y" ] && log_end_msg
# wait for devices to come up
wait_for_udev 10
configure_networking
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/mfs-bottom"
run_scripts /scripts/mfs-bottom
[ "$quiet" != "y" ] && log_end_msg
}
passwd: files
group: files
shadow: files
hosts: files dns
protocols: files
services: files
This diff is collapsed.
#!/bin/sh
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
if [ -r /etc/emulab/paths.sh ]; then
. /etc/emulab/paths.sh
else
BINDIR=/etc/testbed
BOOTDIR=/var/emulab/boot
ETCDIR=/etc/emulab
fi
disk="sda"
case $# in
1)
part=$1
;;
2)
part=$1
disk=$2
;;
*)
echo "Usage: $0 partition [disk]"
exit 1
esac
MFS_DEBUG=${MFS_DEBUG:-'n'}
if [ "$MFS_DEBUG" = "y" ]; then
set -x
fi
#
# Handle pseudo arguments in the environment.
#
#
# Find out what our console should be:
# if $CONSOLE is set and valid, use that
# ow console is "sio1"
#
# XXX on Moonshots, only "sio1" is supported.
#
CONSOLE=${SLICEFIX_CONSOLE:-'sio1'}
case $CONSOLE in
sio|sio1)
;;
*)
echo "WARNING: unknown console type \"$CONSOLE\", assuming \"sio1\""
;;
esac
# DOM0MEM is optional
DOM0MEM=$SLICEFIX_DOM0MEM
if [ -r $ETCDIR/bossnode ]; then
bossnode=`cat $ETCDIR/bossnode`;
setboss=1
else
setboss=0
fi
# Indicates the MFS has been properly localized and we can copy stuff
# into the image.
LOCALIZED1="/.localized"
LOCALIZED2="/root/.localized"
islocalized() {
if [ -e $LOCALIZED1 -o -e $LOCALIZED2 ]; then
return 0;
fi
return 1;
}
#
# Get the last setting of a loader variable from the list of standard files
#
getloadervar() {
_var=$1
_mnt=$2
_flist="$_mnt/boot/defaults/loader.conf $_mnt/boot/device.hints $_mnt/boot/loader.conf $_mnt/boot/loader.conf.local"
_last=`grep "^${_var}=" $_flist 2>/dev/null | tail -1`
_val=`echo ${_last#*=} | sed -e 's/^"//' -e 's/"$//'`
echo $_val
}
dolinux() {
isroot=0
# XXX assume part 2 is root right now
if [ $part -eq 2 ]; then
isroot=1
fi
#
# Turn off time-dependent fsck.
#
check=`dumpe2fs /dev/${disk}${part} 2>/dev/null | \
grep 'Check interval:' | \
sed -e 's/.*Check interval: *\([0-9]*\).*/\1/'`
if [ $check -ne 0 ]; then
echo " disabling time-dependent fsck"
tune2fs -i 0 /dev/${disk}${part} >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo " WARNING: could not disable time-dependent fsck"
fi
fi
# The rest is just for the root FS
if [ $isroot -eq 0 ]; then
return
fi
rootdev=/dev/${disk}${part}
#
# See if there is a valid filesystem UUID to use in fstab and grub.
#
RUUID=`dumpe2fs $rootdev 2>/dev/null | grep UUID: | \
sed -e 's/.*UUID: *\([^ ]*\).*/\1/'`
#
# To be pedantic, we should do the following (generate a new
# UUID). Note that this will cause the root FS to be fsck'ed
# everytime (see needfsck below).
#
if [ -n "$RUUID" ]; then
# generate/install a new random UUID with tune2fs
echo " setting new root FS UUID"
tune2fs -U random $rootdev 2>/dev/null
RUUID=`dumpe2fs $rootdev 2>/dev/null | grep UUID: | \
sed -e 's/.*UUID: *\([^ ]*\).*/\1/'`
fi