Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/linux
Show All 12 Lines | |||||
desc="Enable Linux ABI" | desc="Enable Linux ABI" | ||||
rcvar="linux_enable" | rcvar="linux_enable" | ||||
start_cmd="${name}_start" | start_cmd="${name}_start" | ||||
stop_cmd=":" | stop_cmd=":" | ||||
linux_start() | linux_start() | ||||
{ | { | ||||
local _emul_path _tmpdir | local _emul_path _tmpdir | ||||
_emul_path="$(sysctl -n compat.linux.emul_path)" | |||||
jkim: This must be done after `load_kld -e 'linux(aout|elf)' linux` below. Otherwise, it may not be… | |||||
load_kld -e 'linux(aout|elf)' linux | load_kld -e 'linux(aout|elf)' linux | ||||
case `sysctl -n hw.machine_arch` in | case `sysctl -n hw.machine_arch` in | ||||
amd64) | amd64) | ||||
load_kld -e 'linux64elf' linux64 | load_kld -e 'linux64elf' linux64 | ||||
;; | ;; | ||||
esac | esac | ||||
if [ -x /compat/linux/sbin/ldconfigDisabled ]; then | if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then | ||||
_tmpdir=`mktemp -d -t linux-ldconfig` | _tmpdir=`mktemp -d -t linux-ldconfig` | ||||
/compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache | ${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache | ||||
if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then | if ! cmp -s ${_tmpdir}/ld.so.cache ${_emul_path}/etc/ld.so.cache; then | ||||
cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache | cat ${_tmpdir}/ld.so.cache > ${_emul_path}/etc/ld.so.cache | ||||
fi | fi | ||||
rm -rf ${_tmpdir} | rm -rf ${_tmpdir} | ||||
fi | fi | ||||
# Linux uses the pre-pts(4) tty naming scheme. | # Linux uses the pre-pts(4) tty naming scheme. | ||||
load_kld pty | load_kld pty | ||||
# Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX. | # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX. | ||||
if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then | if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then | ||||
sysctl kern.elf64.fallback_brand=3 > /dev/null | sysctl kern.elf64.fallback_brand=3 > /dev/null | ||||
fi | fi | ||||
if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then | if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then | ||||
sysctl kern.elf32.fallback_brand=3 > /dev/null | sysctl kern.elf32.fallback_brand=3 > /dev/null | ||||
fi | fi | ||||
if checkyesno linux_mounts_enable; then | if checkyesno linux_mounts_enable; then | ||||
_emul_path="/compat/linux" | |||||
mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" | mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" | ||||
mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" | mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" | ||||
mount -o nocover -t devfs devfs "${_emul_path}/dev" | mount -o nocover -t devfs devfs "${_emul_path}/dev" | ||||
mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" | mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" | ||||
mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" | mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" | ||||
fi | fi | ||||
} | } | ||||
load_rc_config $name | load_rc_config $name | ||||
run_rc_command "$1" | run_rc_command "$1" |
This must be done after load_kld -e 'linux(aout|elf)' linux below. Otherwise, it may not be defined.