summaryrefslogtreecommitdiffstats
path: root/lkm/linux/linux.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>1996-03-10 08:42:54 +0000
committersos <sos@FreeBSD.org>1996-03-10 08:42:54 +0000
commit7d151a09c3f9613590f35dad81c77959e4f34381 (patch)
treeab85b2b967b056b586d4e20e909a63357cd88185 /lkm/linux/linux.c
parentbfb211a9a540fa804c574162f720bebded3fcddf (diff)
downloadFreeBSD-src-7d151a09c3f9613590f35dad81c77959e4f34381.zip
FreeBSD-src-7d151a09c3f9613590f35dad81c77959e4f34381.tar.gz
First attempt at FreeBSD & Linux ELF support.
Compile and link a new kernel, that will give native ELF support, and provide the hooks for other ELF interpreters as well. To make native ELF binaries use John Polstras elf-kit-1.0.1.. For the time being also use his ld-elf.so.1 and put it in /usr/libexec. The Linux emulator has been enhanced to also run ELF binaries, it is however in its very first incarnation. Just get some Linux ELF libs (Slackware-3.0) and put them in the prober place (/compat/linux/...). I've ben able to run all the Slackware-3.0 binaries I've tried so far. (No it won't run quake yet :)
Diffstat (limited to 'lkm/linux/linux.c')
-rw-r--r--lkm/linux/linux.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lkm/linux/linux.c b/lkm/linux/linux.c
index 67faa18..dbd319f 100644
--- a/lkm/linux/linux.c
+++ b/lkm/linux/linux.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux.c,v 1.3 1995/11/13 07:18:38 bde Exp $
+ * $Id: linux.c,v 1.4 1995/11/14 07:34:18 bde Exp $
*/
#include <sys/param.h>
@@ -34,14 +34,24 @@
#include <sys/conf.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
+#include <sys/imgact_elf.h>
+#include "i386/linux/linux.h"
extern const struct execsw linux_execsw;
MOD_EXEC(linux, -1, (struct execsw*)&linux_execsw);
+static Elf32_Interp_info linux_interp = {
+ &elf_linux_sysvec,
+ "/lib/ld-linux.so.1",
+ "/compat/linux"
+ };
+
static int
linux_load(struct lkm_table *lkmtp, int cmd)
{
+ if (elf_insert_interp(&linux_interp))
+ uprintf("Could not install ELF interpreter entry\n");
uprintf("Linux emulator installed\n");
return 0;
}
@@ -49,6 +59,8 @@ linux_load(struct lkm_table *lkmtp, int cmd)
static int
linux_unload(struct lkm_table *lkmtp, int cmd)
{
+ if (elf_remove_interp(&linux_interp))
+ uprintf("Could not deinstall ELF interpreter entry\n");
uprintf("Linux emulator removed\n");
return 0;
}
OpenPOWER on IntegriCloud