Menu

[r803]: / trunk / build / freenas-create-bootdir.sh  Maximize  Restore  History

Download this file

119 lines (105 with data), 3.2 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh
#
# This script was written by David Courtney of Ultradesic
# http://www.ultradesic.com
# E-Mail Contact: minibsd@ultradesic.com
#
# Adapted for m0n0wall on FreeBSD 6.1 by Olivier Cochard-Labbé (http://www.freenas.org)
# Modified by Volker Theile (votdev@gmx.de)
MINIBSD_DIR=${FREENAS_ROOTDIR}/bootloader;
ARCH=$(uname -p)
# Initialize variables.
opt_a=0
opt_d=0
opt_s=0
opt_f=0
opt_b=0
# Parse the command-line options.
while getopts 'adfhs' option
do
case "$option" in
"a") opt_a=1;;
"d") opt_d=1;;
"f") opt_f=1;;
"s") opt_s=1;;
"b") opt_b=1;;
"h") echo "$(basename $0): Build boot loader";
echo "Common Options:";
echo " -a Disable ACPI"
echo " -d Enable debug"
echo " -s Enable serial console";
echo " -f Force executing this script";
echo " -b Enable boot splash";
exit 1;;
?) echo "$0: Bad option specified. Exiting...";
exit 1;;
esac
done
shift `expr $OPTIND - 1`
echo "Building the boot loader..."
if [ -n "$1" ]; then
MINIBSD_DIR=$1
echo "Using directory $1."
fi
if [ 1 != $opt_f -a -d "$MINIBSD_DIR" ]; then
echo
echo "=> $MINIBSD_DIR already exists. Remove the directory"
echo "=> before running this script."
echo
echo "=> Exiting..."
echo
exit 1
fi
# Create the boot directory that will contain boot, and kernel
mkdir $MINIBSD_DIR
mkdir $MINIBSD_DIR/defaults
mkdir $MINIBSD_DIR/kernel
# Copy the file in this directory:
cp -v /boot/defaults/loader.conf $MINIBSD_DIR/defaults
cp -v /boot/loader $MINIBSD_DIR
cp -v /boot/boot $MINIBSD_DIR
cp -v /boot/mbr $MINIBSD_DIR
cp -v /boot/cdboot $MINIBSD_DIR
cp -v /boot/loader.4th $MINIBSD_DIR
cp -v /boot/support.4th $MINIBSD_DIR
cp -v /boot/device.hints $MINIBSD_DIR
# Generate the loader.rc file using by bootloader
echo "Generate $MINIBSD_DIR/loader.rc"
echo 'include /boot/loader.4th
start
check-password' > $MINIBSD_DIR/loader.rc
# Generate the loader.conf file using by bootloader
echo "Generate $MINIBSD_DIR/loader.conf"
echo 'mfsroot_load="YES"
mfsroot_type="mfs_root"
mfsroot_name="/mfsroot"
# Enable boot splash?
if [ 0 != $opt_b ]; then
echo 'splash_bmp_load="YES"' >> $MINIBSD_DIR/loader.conf
echo 'bitmap_load="YES"' >> $MINIBSD_DIR/loader.conf
echo 'bitmap_name="/boot/splash.bmp"' >> $MINIBSD_DIR/loader.conf
fi
#Reduce Kernel timer frequency for better performace in Virtual environement
#explanation here: http://ivoras.sharanet.org/freebsd/vmware.html
kern.hz="100"
autoboot_delay="-1"' > $MINIBSD_DIR/loader.conf
# Enable debug?
if [ 0 != $opt_d ]; then
echo 'verbose_loading="YES"' >> $MINIBSD_DIR/loader.conf
echo 'boot_verbose=""' >> $MINIBSD_DIR/loader.conf
fi
# Enable serial console?
if [ 0 != $opt_s ]; then
echo 'console="comconsole"' >> $MINIBSD_DIR/loader.conf
fi
# Disable ACPI?
if [ 0 != $opt_a ]; then
echo 'hint.acpi.0.disabled="1"' >> $MINIBSD_DIR/device.hints
fi
# Copy kernel.
if [ -e "/usr/obj/usr/src/sys/FREENAS-$ARCH/kernel.gz" ] ; then
cp /usr/obj/usr/src/sys/FREENAS-$ARCH/kernel.gz $MINIBSD_DIR/kernel
else
echo "=> ERROR: File kernel.gz does not exist!";
exit 1;
fi
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.