Subject: How to setup linux emulation - Again
To: None <port-i386@NetBSD.ORG>
From: Tim W. Janes <janes@signal.dra.hmg.gb>
List: port-i386
Date: 04/25/1997 23:22:54
I'm having a bad week. 

Many thanks for the swift replies to my previous post. 
I'm sorry I just did not think of looking in the man pages. 

I still can't get linux emulation going.

I have done a fresh installation of NetBSD 1.2.1 but still I have a problem.

I have built a kernel with 

#options                COMPAT_SVR4     # binary compatibility with SVR4
options         COMPAT_IBCS2    # binary compatibility with SCO and ISC
options         COMPAT_LINUX    # binary compatibility with Linux
options         COMPAT_FREEBSD  # binary compatibility with FreeBSD
options         EXEC_ELF32
( Although I think EXEC_ELF32 is not relevant until the later linux compatibility patches?)

I have copied ldconfig and lld from linux to /usr/local/bin/ldconfig-linux and /usr/local/bin/ldd-linux
and have copied /usr/lib/ld.so and /usr/lib/libc.so.5.3.12 to /emul/linux/lib. 

Running ldconfig-linux correctly generates /emul/linux/etc/ld.so.cache

running ldd-linux `which ldd-linux` seems to work 

titan0:##uname -a
NetBSD titan0.dra.hmg.gb 1.2.1 NetBSD 1.2.1 (NETBSD) #0: Fri Apr 25 03:50:18 PDT 1997     root@titan0.dra.hmg.gb:/usr/src/sys/arch/i386/compile/NETBSD i386
titan0:##ldd-linux `which ldd-linux`
        statically linked (ELF)

looking good - but with bc copied from linux 

titan0:##file bc
bc: ELF 32-bit LSB executable, Intel 80386, version 1   
titan0:##ldd-linux bc
ldd-linux: can't execute bc (Exec format error)
titan0:##./bc
./bc: Exec format error. Wrong Architecture.
titan0:##sum bc /emul/linux/lib/*
25092 48 bc
19113 58 /emul/linux/lib/ld.so
13908 571 /emul/linux/lib/libc.so.5
13908 571 /emul/linux/lib/libc.so.5.3.12
titan0:##ls -lR /emul
total 2
drwxr-xr-x  4 root  wheel  512 Apr 23 12:33 linux

/emul/linux:
total 4
drwxr-xr-x  2 root  wheel  512 Apr 23 13:43 etc
drwxr-xr-x  2 root  wheel  512 Apr 25 06:29 lib

/emul/linux/etc:
total 2
-rw-r--r--  1 root  wheel  100 Apr 23 13:43 ld.so.cache

/emul/linux/lib:
total 1284
-rwxr-xr-x  1 root  wheel   59305 Apr 23 12:33 ld.so
lrwxrwxrwx  1 root  wheel      14 Apr 25 04:25 libc.so.5 -> libc.so.5.3.12
-rwxr-xr-x  1 root  wheel  583795 Apr 23 12:23 libc.so.5.3.12
titan0:##rsh cd2pc
...
cd2pc:~# uname -a
Linux cd2pc 2.0.27 #4 Sat Mar 1 23:09:37 GMT 1997 i486
cd2pc:~# ldd /usr/bin/bc
        libc.so.5 => /lib/libc.so.5.3.12
cd2pc:~# sum /usr/bin/bc /lib/libc.so.5.3.12 /lib/ld.so
25092    48 /usr/bin/bc
13908   571 /lib/libc.so.5.3.12
19113    58 /lib/ld.so

Apologies for again troubling you all for what I am sure is a stupid mistake on my part.
I am just stuck.

Should I upgrade to the 1.2D snapshot? - If I do I would need the
kernel source to recompile - is it alright to use the kernel source
from -current. Or where can I get 1.2D kernel source?

Many thanks for any suggestions

Tim.