|
root / services / hammerhead / devfs / start.sh
start.sh Bash 29 lines 1.0 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
#!/bin/zsh
# devfs/start.sh — populate /dev and configure socket protocol modules
#
# Mirrors SMF's system/device/local method (lib/svc/method/devices-local).
# devfsadm configures hardware; soconfig loads /etc/sock2path.d into kernel
# sockfs so socket(AF_INET, ...) and socket(AF_INET6, ...) actually return
# a valid fd. Without soconfig, every socket() of those families fails
# EAFNOSUPPORT and ifconfig cannot configure any interface — including lo0.

set -e
set -u

# Hardware device configuration. Hammerhead's SMF runs this unconditionally
# (upstream illumos only runs it on reconfigure boots, which leaves PCI
# NICs unattached on fresh deploys); we follow Hammerhead's convention.
/usr/sbin/devfsadm

# Force PCI bus enumeration in case devfsadm alone didn't trigger it.
/usr/bin/ls /devices/pci@0,0/ > /dev/null 2>&1 || true

# Load AF_* → STREAMS-module mappings into the kernel sockfs. THIS is the
# step that makes socket(AF_INET, ...) work.
/sbin/soconfig -d /etc/sock2path.d

# Refresh kernel driver.conf cache.
/usr/sbin/devfsadm -I

exit 0