Changeset View
Changeset View
Standalone View
Standalone View
libexec/rc/rc.d/linux
Show All 9 Lines | |||||
. /etc/rc.subr | . /etc/rc.subr | ||||
name="linux" | name="linux" | ||||
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_mount() { | |||||
local _fs _mount_point | |||||
_fs="$1" | |||||
_mount_point="$2" | |||||
shift 2 | |||||
if ! mount | grep -q "^$_fs on $_mount_point ("; then | |||||
mkdir -p "$_mount_point" | |||||
mount "$@" -t "$_fs" "$_fs" "$_mount_point" | |||||
fi | |||||
} | |||||
linux_start() | linux_start() | ||||
{ | { | ||||
local _emul_path _tmpdir | local _emul_path _tmpdir | ||||
case `sysctl -n hw.machine_arch` in | case `sysctl -n hw.machine_arch` in | ||||
aarch64) | aarch64) | ||||
load_kld -e 'linux64elf' linux64 | load_kld -e 'linux64elf' linux64 | ||||
;; | ;; | ||||
Show All 30 Lines | linux_start() | ||||
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 | ||||
mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc" | linux_mount linprocfs "${_emul_path}/proc" -o nocover | ||||
mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys" | linux_mount linsysfs "${_emul_path}/sys" -o nocover | ||||
mount -o nocover -t devfs devfs "${_emul_path}/dev" | linux_mount devfs "${_emul_path}/dev" -o nocover | ||||
mount -o nocover,linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd" | linux_mount fdescfs "${_emul_path}/dev/fd" -o nocover,linrdlnk | ||||
mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" | linux_mount tmpfs "${_emul_path}/dev/shm" -o nocover,mode=1777 | ||||
fi | fi | ||||
} | } | ||||
load_rc_config $name | load_rc_config $name | ||||
run_rc_command "$1" | run_rc_command "$1" |