fs-root revision 7c478bd95313f5f23a4c958a745db2134aa03244
18920d790825d96ca3943aa2dcb6eb80dc611c5fTinderbox User# CDDL HEADER START
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# The contents of this file are subject to the terms of the
e9e4257668ff6c4e583b0c0db2508650b0b677b8Tinderbox User# Common Development and Distribution License, Version 1.0 only
c57668a2fbbe558c1bd21652813616f2f517c469Tinderbox User# (the "License"). You may not use this file except in compliance
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews# with the License.
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
950d203b64f512b85fcc093ee1e9e3e531a1aea3Tinderbox User# See the License for the specific language governing permissions
b886b04d8d2b085cbf3e1bf4442dee87f43ba5e4Tinderbox User# and limitations under the License.
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# When distributing Covered Code, include this CDDL HEADER in each
e676a596869d8a80a644c99a848afb53d1c5975eMark Andrews# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# If applicable, add the following below this CDDL HEADER, with the
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews# fields enclosed by brackets "[]" replaced with your own identifying
a7c412f37cc73d0332887a746e81220cbf09dd00Mark Andrews# information: Portions Copyright [yyyy] [name of copyright owner]
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# CDDL HEADER END
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# Use is subject to license terms.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# ident "%Z%%M% %I% %E% SMI"
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# All rights reserved.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# Make sure that the libraries essential to this stage of booting can be found.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # If there is an optimized libc available in /usr that fits this
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews /usr/sbin/mount | egrep -s "^/lib/libc.so.1 on "
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt if [ $? -ne 0 ]; then
dc238a06bffa79de141ee7655765e2df91498a8aTinderbox User /usr/sbin/mount -O -F lofs $MOE /lib/libc.so.1
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt LIBC_MOE_32=`/usr/bin/moe -32 '/platform/sun4v/lib/libc_psr/$HWCAP'`
0e573cdd111e060e5f6c18249b5ccacbe8abe278Tinderbox User /usr/sbin/mount | egrep -s "^/platform/sun4v/lib/libc_psr.so.1 on "
aa9c561961e9d877946ebaa8795fa2be054ab7bfEvan Hunt if [ $? -ne 0 ]; then
710bce1a85c96e85ca1a90471382055acd29d51fTinderbox User /usr/sbin/mount -O -F lofs $LIBC_MOE_32 /platform/sun4v/lib/libc_psr.so.1
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews LIBC_MOE_64=`/usr/bin/moe -64 '/platform/sun4v/lib/sparcv9/libc_psr/$HWCAP'`
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews /usr/sbin/mount | egrep -s "^/platform/sun4v/lib/sparcv9/libc_psr.so.1 on "
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews if [ $? -ne 0 ]; then
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews /usr/sbin/mount -O -F lofs $LIBC_MOE_64 /platform/sun4v/lib/sparcv9/libc_psr.so.1
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# Most of the operations in this script are only necessary in the global
9513a2a6670951f5cf5477fcfec9f933fcaff628Automatic Updater# zone but due to the way initialization scripts like this are packaged,
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews# it needs to currently exist for all zones.
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrewsif [ "${_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt# Root is already mounted (by the kernel), but still needs to be
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt# checked, possibly remounted and entered into mnttab. First
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt# mount /usr read only if it is a separate file system. This must
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt# be done first to allow utilities such as fsck and setmnt to
2ae159b376dac23870d8005563c585acf85a4b5aEvan Hunt# reside on /usr minimizing the space required by the root file
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrewsif [ -n "$mountp" ]; then
27739dd25026283c24645c8a1044b95ef9eb5ac6Tinderbox User # Mount without the cache initially. We'll enable it
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # later at remount time. This lets us avoid
18920d790825d96ca3943aa2dcb6eb80dc611c5fTinderbox User # teaching the statically linked mount program about
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # cachefs. Here we determine the backfstype.
7a6494cfb6cc7d3f67af07359561e05e6bb8c0edTinderbox User # This is not pretty, but we have no tools for parsing
0e573cdd111e060e5f6c18249b5ccacbe8abe278Tinderbox User # the option string until we get /usr mounted...
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # Must use -o largefiles here to ensure the
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # read-only mount does not fail as a result of
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # having a large file present on /usr. This gives
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews # fsck a chance to fix up the largefiles flag
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User # before we remount /usr read-write.
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User if [ "x$mntopts" = x- ]; then
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont # Requesting logging on a read-only mount
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews # causes errors to be displayed, so remove
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews # "logging" from the list of options for now.
2a31bd531072824ef252c18303859d6af7451b00Francis Dupont # The read-write mount performed later will
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews # specify the logging option if appropriate.
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews mountfs -O /usr $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# Also mount /boot now so that things like keymap.sh can access
c651f15b30f1dae5cc2f00878fb5da5b3a35a468Mark Andrews# boot properties through eeprom. Readonly isn't required because
e20788e1216ed720aefa84f3295f7899d9f28c22Mark Andrews# /boot (and other pcfs filesystems) aren't fsck'ed at boot yet.
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# Also, we don't account for caching /boot as it must be on a local
dedefc0bdbb4e6e39eeb98aa2fc6883efec2ddb0Mark Andrews# disk. So what's in vfstab is fine as it stands; just look to see
01a5c5503482fb3ba52088bf0178a7213273bf96Mark Andrews# if it's there and avoid the mount if not.
cdfc81e048bd34c1d628380247bda6b80a89e20eAutomatic Updaterif [ -n "$mountp" ]; then
0eb371ca0dab50ae3462e98794a6126198c52f4bMark Andrews mountfs - /boot $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
fe80a4909bf62b602feaf246866e9d29f7654194Automatic Updater# Update kernel driver.conf cache with any additional driver.conf
9ecb5d33470ebfb3719a1b8d56bcefdf4b27f7b2Tinderbox User# files found on /usr, and device permissions from /etc/minor_perm.