13 desc="Enable Linux ABI"
15 start_cmd="${name}_start"
19 local _fs _mount_point
23 if ! mount | grep -q "^$_fs on $_mount_point ("; then
24 mkdir -p "$_mount_point"
25 mount "$@" -t "$_fs" "$_fs" "$_mount_point"
31 local _emul_path _tmpdir
33 case `sysctl -n hw.machine_arch` in
35 load_kld -e 'linux64elf' linux64
38 load_kld -e 'linuxelf' linux
39 load_kld -e 'linux64elf' linux64
42 load_kld -e 'linuxelf' linux
46 _emul_path="$(sysctl -n compat.linux.emul_path)"
48 if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then
49 _tmpdir=`mktemp -d -t linux-ldconfig`
50 ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
51 if ! cmp -s ${_tmpdir}/ld.so.cache ${_emul_path}/etc/ld.so.cache; then
52 cat ${_tmpdir}/ld.so.cache > ${_emul_path}/etc/ld.so.cache
57 # Linux uses the pre-pts(4) tty naming scheme.
60 # Explicitly load the filesystem modules; they are usually required,
61 # even with linux_mounts_enable="NO".
66 # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX.
67 if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then
68 sysctl kern.elf64.fallback_brand=3 > /dev/null
71 if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then
72 sysctl kern.elf32.fallback_brand=3 > /dev/null
75 if checkyesno linux_mounts_enable; then
76 linux_mount linprocfs "${_emul_path}/proc" -o nocover
77 linux_mount linsysfs "${_emul_path}/sys" -o nocover
78 linux_mount devfs "${_emul_path}/dev" -o nocover
79 linux_mount fdescfs "${_emul_path}/dev/fd" -o nocover,linrdlnk
80 linux_mount tmpfs "${_emul_path}/dev/shm" -o nocover,mode=1777