[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Using Linux emulation in FreeBSD to run a Debian Linux userland



Dear Everyone,

I understand that Debian GNU/kFreeBSD currently builds software using
the FreeBSD ABI. It might be easier to make some changes to FreeBSD's
linux emulation and Debian Linux's packages so that the FreeBSD kernel
could boot a Linux userland using the same binaries used in Debian
Linux. This would make many things start working and reduce the things
that you need to maintain dramatically.

There is not much interest in this in either Gentoo or FreeBSD, but I
thought it might be worthwhile to share the idea with you.  Right now, I
have Gentoo Linux's userland running in a FreeBSD jail nearly perfectly,
so it is definitely possible.

The only issues that I have encountered running Gentoo Linux in a jail
are as follows:

1. FreeBSD's Linuxulator does not support amd64
2. ptrace does not appear to work on the amd64 FreeBSD kernel (breaking
gdb, strace and glibc compilation).
3. A few binaries do system calls that didn't exist in Linux 2.6.16
(breaking build systems)

I assume that #2 would not be a problem if my host system was i386
instead of amd64. I worked around #3 by making rm, tar and touch
symlinks to busybox. With that said, this should be much easier to
maintain than what Debian GNU/kFreeBSD is now. I also understand that
one of the FreeBSD developers has Debian Linux running in a jail, so
this is definitely possible.

Some improvements will need to be made to the Linuxulator so that the
userland will be able to manage the kernel. In particular, it would need
hooks to enable the following commands to work:

sysctl
lsmod
insmod
modprobe
rmmod
reboot
shutdown
zfs
zpool

In addition, the FreeBSD kernel should have a kernel setting added to
enable these hooks so that the changes could be merged into FreeBSD. It
would be set in the bootloader's equivalent of /etc/loader.conf.

Beyond that, there would also need to be an abstraction made in Debian's
package manager so that packages for out-of-tree modules will be
replaced with ones that work with the FreeBSD kernel. This might also
require changes to the Linuxulator to accommodate that.

Once that is implemented, Debian GNU/kFreeBSD will be able to improve by
implementing currently unimplemented syscalls in the Linuxulator and by
extending the Linuxulator to support more architectures.

Yours truly,
Richard Yao

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: