blob: f42ed22a6d6ff1849e1b7469ff4606e8d56ce34d (
plain)
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
|
# NFS filesystem mounting -*- shell-script -*-
# FIXME This needs error checking
# parse nfs bootargs + launch ipconfig and nfsmount
do_nfsmount()
{
# support ip options see linux sources Documentation/nfsroot.txt
case ${IPOPTS} in
none|off)
# Do nothing
;;
""|on|any)
# Bring up device
ipconfig ${DEVICE}
;;
dhcp|bootb|rarp|both)
ipconfig -c ${IPOPTS} -d ${DEVICE}
;;
*)
ipconfig -d $IPOPTS
# grab device entry from full line
NEW_DEVICE=${IPOPTS#*:*:*:*:*:*}
NEW_DEVICE=${NEW_DEVICE%:*}
if [ -n "${NEW_DEVICE}" ]; then
DEVICE="${NEW_DEVICE}"
fi
# grab server-ip
SERVER_IP=${IPOPTS#*:}
SERVER_IP=${SERVER_IP%:*:*:*:*:*:*}
;;
esac
# FIXME: source ipconfig output - might overwrite aboves
. /tmp/net-${DEVICE}.conf
# get nfs root from dhcp
if [ "x${NFSROOT}" = "xauto" ]; then
NFSROOT=${ROOTSERVER}:${ROOTPATH}
# nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
elif [ -n "${NFSROOT}" ]; then
# nfs options are an optional arg
if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then
NFSOPTS="-o ${NFSROOT#*,}"
fi
NFSROOT=${NFSROOT%%,*}
# server-ip could be passed by ip
if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
if [ -n "${SERVER_IP}" ]; then
NFSROOT="${SERVER_IP}:${NFSROOT}"
else
NFSROOT=${ROOTSERVER}:${ROOTPATH}
fi
fi
fi
if [ -z "${NFSOPTS}" ]; then
NFSOPTS="-o retrans=10"
fi
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount"
run_scripts /scripts/nfs-premount
[ "$quiet" != "y" ] && log_end_msg
if [ ${readonly} = y ]; then
roflag="-o ro"
else
roflag="-o rw"
fi
nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt}
}
# NFS root mounting
mountroot()
{
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top"
run_scripts /scripts/nfs-top
[ "$quiet" != "y" ] && log_end_msg
modprobe -q nfs
# For DHCP
modprobe -q af_packet
# Default delay is around 180s
# FIXME: add usplash info
if [ -z "${ROOTDELAY}" ]; then
delay=180
else
delay=${ROOTDELAY}
fi
# loop until nfsmount succeds
# FIXME: another place of init bin hardcoding
while [ ${delay} -gt 0 ] && [ ! -e ${rootmnt}/sbin/init ]; do
[ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
do_nfsmount
# FIXME: ipconfig loops every min at least - better param??
delay=$(( ${delay} - 1 ))
[ "$quiet" != "y" ] && log_end_msg
done
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom"
run_scripts /scripts/nfs-bottom
[ "$quiet" != "y" ] && log_end_msg
}
|