Basilisk II on Arm Ubuntu

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Basilisk II on Arm Ubuntu

Post by darthnvader »

I have a Samsung Chormebook running Ubuntu Arm from an SD Card and have managed to build Basilisk II from the latest git source. I had to build it without JIT, but it seems to run ok.

First I had no sound, my system had no /dev/dsp or /dev/mixer, but I found I could run Basilisk with the command:

Code: Select all

padsp BasiliskII
And that got sound working, tho I think it's only mono sound, seems to be coming from only one speeker. No big deal.

I'm having trouble with the Internet, I'm using the Slirp Ethernet Interface and manual TCP/IP.

IP Addr 10.0.2.16
Subnet Mask 255.255.255.0
Router Addr 10.0.2.2
Name Server Addr 10.0.2.3

When I launch my web browser, it connects to the internet and starts to load the web page, then the Mac OS either freezes or BasiliskII Segmentation fault's with the fallowing:

Code: Select all

WARNING: RmvTime(03c86966): Descriptor not found
Caught SIGSEGV at address 0x74a21000 [IP=0x768c90d8]
D0: 00000000 D1: 000005dc D2: 00189fa0 D3: 00000000 
D4: 00000000 D5: 000a9350 D6: 00000000 D7: 000e9f90 
A0: 003c12be A1: 0000000f A2: 0013ca94 A3: 0000f744 
A4: 0000f744 A5: 00189fa0 A6: 56b77a6f A7: 03c0dd74 
USP=00000000 ISP=03c0dd74 MSP=00000000 VBR=00000000
T=00 S=1 M=0 X=1 N=0 Z=1 V=0 C=0 IMASK=1
FP0: 8 FP1: nan FP2: nan FP3: nan 
FP4: nan FP5: nan FP6: nan FP7: nan 
N=0 Z=0 I=0 NAN=0
0400a29a: 7129 4a80 67f4 08f8 0006 EMULOP.L #$00000029
next PC: 0400a29c
Segmentation fault (core dumped)
Here's what I get with a freeze:

Code: Select all

WARNING: RmvTime(03c46956): Descriptor not found
Caught SIGSEGV at address 0x74921000 [IP=0x769180d8]
D0: 00000000 D1: 000005dc D2: 002e8380 D3: 00000000 
D4: 000a5d78 D5: 0000a3c1 D6: 00000000 D7: 76f100c7 
A0: 003c12be A1: 000a5d60 A2: 0013ca94 A3: 0000f744 
A4: 0000f744 A5: 002e8380 A6: 000e9f90 A7: 03bcddba 
USP=00000000 ISP=03bcddba MSP=00000000 VBR=00000000
T=00 S=1 M=0 X=1 N=0 Z=1 V=0 C=0 IMASK=1
FP0: 247398 FP1: 494796 FP2: nan FP3: nan 
FP4: nan FP5: nan FP6: nan FP7: nan 
N=0 Z=0 I=0 NAN=0
0400a29a: 7129 4a80 67f4 08f8 0006 EMULOP.L #$00000029
next PC: 0400a29c

I'm running Mac OS 8.1, but I also tried OS 7.5.3. I've tried iCab, I.E., and Netscape. I also tried changing the cpu 68030, 68030 with FPU, and 68040, but that didn't help.

Anyone know how I can fix or debug this Inernet issue?

Thanks
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Basilisk II on Arm Ubuntu

Post by galgot »

Same here on a R-pi. I get segmentation fault or freeze.
I've tried Mac OS 7.6.1 and 7.5.3. Tried also using Open Transport or MacTCP, but same result.
If I launch Mosaic , it starts to load page , then crash, or freeze the OS, same with MacLynx.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

galgot wrote:Same here on a R-pi. I get segmentation fault or freeze.
I've tried Mac OS 7.6.1 and 7.5.3. Tried also using Open Transport or MacTCP, but same result.
If I launch Mosaic , it starts to load page , then crash, or freeze the OS, same with MacLynx.
Do you have your Kernel source installed?

If so, you could try and build the Sheep_Net module and see if that fixes the trouble.

I have my Kernel source, in a .tar.gz, but I don't know how to install it. So I can't build the module.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

Ok, I managed to build the Sheep_Net Module on my system and load it, but when I chose my Wifi connection I get:

Code: Select all

WARNING: Cannot attach to Ethernet card (Invalid argument). Ethernet will not be available.
I know that Sheep_Net works over Wifi from this post:
fatfreddie wrote:Okay, I finally got a working connection to the internet over wlan0 and static IP. Don't know why it didn't work before, I propably confused some of the connection details in the MacOS ethernet configuration. Thanks again Cat_7 for hinting me in the right direction!

Couldn't check for filesharing capabilities, yet (netatalk doesn't seem to work), but will report back as soon as I tested it.
In this thread:

http://www.emaculation.com/forum/viewto ... 0&start=25

So I'm not sure what's going wrong, but maybe you can make it work on the R-Pi.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Basilisk II on Arm Ubuntu

Post by adespoton »

Just so you know: AppleTalk definitely won't work over WiFi, even if you get the TCP/IP stack working.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Basilisk II on Arm Ubuntu

Post by neozeed »

run it under GDB... I'm assuming that you have -g in the CFLAGS somewhere.

also normally with slirp you use 10.0.2.15 as your IP, although it shouldn't matter too much.

slirp can be very touchy.
don't do today what you can put off until tomorrow.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

Hmmm.....No luck, when ever I try to run BasiliskII with GDB it hangs when the video loads with:

Code: Select all

Reading ROM file...
[New Thread 0x7016d2e0 (LWP 1890)]
[New Thread 0x6f96d2e0 (LWP 1891)]
WARNING: Cannot open audio: No available audio device
WARNING: No audio device found, audio output will be disabled.

Program received signal SIGSEGV, Segmentation fault.
video_vosf_profitable (duration_p=<optimized out>, n_page_faults_p=<optimized out>)
    at ./../CrossPlatform/video_vosf.h:245
245					addr[0] = 0; // Trigger Screen_fault_handler()
(gdb) step
240			for (uint32 p = 0; p < mainBuffer.pageCount; p++) {
(gdb) step
[Thread 0x74bff2e0 (LWP 1886) exited]
245					addr[0] = 0; // Trigger Screen_fault_handler()

So I can't get to the Core Dump of the crash, because the system never boots.
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Basilisk II on Arm Ubuntu

Post by neozeed »

yeah, thats the fun of the video on segfault, as it'll trip things up.

try re-building without VOSF
don't do today what you can put off until tomorrow.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

neozeed wrote:yeah, thats the fun of the video on segfault, as it'll trip things up.

try re-building without VOSF
When I built, I configured with:

Code: Select all

./configure --enable-sdl-video --enable-sdl-audio --disable-vosf
But that doesn't seem to disable VOSF, do you know any other way of disabling it?
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Basilisk II on Arm Ubuntu

Post by neozeed »

I'll have to check, where it turns it on.. config.h? Conf.h?

Try

egrep -rl VOSF *

One of them should be a header built by configure that tells it what to actually do...
don't do today what you can put off until tomorrow.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

Thanks, I found it in the config.h.

So I managed to build Basilisk II without VOSF and boot with GDB, here's what I got with an OS freeze when launching the web browser.

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x6f96d2e0 (LWP 5525)]
0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) step
Single stepping until exit from function memcpy,
which has no line number information.
Caught SIGSEGV at address 0x74321000 [IP=0x769b60d8]
D0: 001fa172 D1: 00000000 D2: 00000038 D3: 00000000 
D4: 00000000 D5: 00000006 D6: 0000000e D7: 00000000 
A0: 00181c28 A1: 0017ad8c A2: 0017ad8c A3: 00181c3c 
A4: 00179c2c A5: 0011f75e A6: 00152fa8 A7: 00152f78 
USP=00000000 ISP=001530e0 MSP=00000000 VBR=00000000
T=00 S=1 M=0 X=0 N=0 Z=0 V=0 C=0 IMASK=0
FP0: 8 FP1: 0 FP2: nan FP3: nan 
FP4: nan FP5: nan FP6: nan FP7: nan 
N=0 Z=0 I=0 NAN=0
001fa224: 0008 2d43 4e75 206e 2f04 MOVE.L #$00000001,D0
next PC: 001ddb20
[Thread 0x6e4dd2e0 (LWP 5527) exited]
0x76fad364 in pthread_mutex_unlock ()
   from /lib/arm-linux-gnueabihf/libpthread.so.0
(gdb) step
Single stepping until exit from function pthread_mutex_unlock,
which has no line number information.
0x76fad288 in __pthread_mutex_unlock_usercnt ()
   from /lib/arm-linux-gnueabihf/libpthread.so.0
(gdb) next
Single stepping until exit from function __pthread_mutex_unlock_usercnt,
which has no line number information.
0x76fed64e in ?? () from /lib/ld-linux-armhf.so.3
(gdb) n
Cannot find bounds of current function
(gdb) step
Cannot find bounds of current function

I don't really know how to use GDB, so I'm not sure if this info is helpful or not. I believe I built with -g. I can't seem to get a core dump when running in GDB, Basilisk II just freezes, it doesn't crash with a core dump. If I run it outside GDB It will crash with a Core Dump.

neozeed, does this debug info give you any idea what is going wrong?

Do you have any tip for me on how to use GDB?
neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Basilisk II on Arm Ubuntu

Post by neozeed »

sure almost there..

from the gdb prompt type in


bt

this will give us the backtrace to see where, and how that memcpy was called incorrectly
don't do today what you can put off until tomorrow.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

Doesn't seem to offer much help?

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x6f96d2e0 (LWP 2175)]
0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) bt
#0  0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
#1  0x743004ec in ?? ()
#2  0x743004ec in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) bt
#0  0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
#1  0x743004ec in ?? ()
#2  0x743004ec in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) step
Single stepping until exit from function memcpy,
which has no line number information.
Caught SIGSEGV at address 0x74321000 [IP=0x769b60d8]
D0: 03ffd9c0 D1: 000000be D2: 0000022d D3: 00000004 
D4: 0000022d D5: 00000000 D6: 00000000 D7: 00000000 
A0: 003a5dce A1: 003a5d10 A2: 0000f050 A3: 03ffd970 
A4: 03ffcdb0 A5: 00000000 A6: 0008a958 A7: 03cb2e24 
USP=00000000 ISP=03cb2e24 MSP=00000000 VBR=00000000
T=00 S=1 M=0 X=0 N=1 Z=0 V=0 C=1 IMASK=0
FP0: 9.22337e+18 FP1: 0 FP2: nan FP3: nan 
FP4: nan FP5: nan FP6: nan FP7: nan 
N=0 Z=0 I=0 NAN=0
000238c8: b4ac 0024 66f4 6000 00d4 CMP.L (A4,$0024) == $03ffcdd4,D2
next PC: 000238cc
[Thread 0x6e2d62e0 (LWP 2177) exited]
0x76fad364 in pthread_mutex_unlock ()
   from /lib/arm-linux-gnueabihf/libpthread.so.0
(gdb) bt
#0  0x76fad364 in pthread_mutex_unlock ()
   from /lib/arm-linux-gnueabihf/libpthread.so.0
#1  0x76fed64e in ?? () from /lib/ld-linux-armhf.so.3
#2  0x00000000 in ?? ()

neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Basilisk II on Arm Ubuntu

Post by neozeed »

Ugh that doesn't do much :(

In the file with the VOSF setting there should be a CFLAGS line...

you'd need to do a make clean/make but try something like this:

-O0 -g

in place of -O whatever it could be. -O0 turns off optimizations, and -g includes debug symbols, so maybe GCC is being too aggressive...?

Also what version of GCC?

gcc -v
don't do today what you can put off until tomorrow.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

There wasn't any CFLAGS in the config.h, but in the makefile I found:

Code: Select all

CFLAGS =  -g -O2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
CXXFLAGS = -g -O2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -fno-merge-constants -fno-gcse-sm
CPUINCLUDES_FLAGS=-I../uae_cpu
CPUINCLUDES_FLAGS:=$(CPUINCLUDES_FLAGS:-I%=-I./%)
CPPFLAGS =  -I./../include -I./. -I. -I./../CrossPlatform $(CPUINCLUDES_FLAGS) -I./../slirp
I changed it to:

Code: Select all

CFLAGS =  -g -O0 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
CXXFLAGS = -g -O0 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -fno-merge-constants -fno-gcse-sm
But that didn't seem to do anything:
I'm assuming I don't need to add -g -O0 to the CPPFLAGS?

Code: Select all


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7016d2e0 (LWP 2003)]
0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
(gdb) bt
#0  0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
#1  0x7016c330 in ?? ()
Cannot access memory at address 0x0
#2  0x7016c330 in ?? ()
Cannot access memory at address 0x0
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) bt
#0  0x769b60d8 in memcpy () from /lib/arm-linux-gnueabihf/libc.so.6
#1  0x7016c330 in ?? ()
#2  0x7016c330 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Code: Select all

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.7/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)

neozeed
Apple Corer
Posts: 293
Joined: Sun Aug 25, 2013 3:25 am
Location: Hong Kong

Re: Basilisk II on Arm Ubuntu

Post by neozeed »

darn, it's not telling us anything useful. :(

Obviously doing a memcpy to a 0x0 destination is a 'bad thing' and going to explode, but it's not saying where it came from, so I guess it's internal to LIBC.

my hackified BII runs on the PowerPC, I'll have to try a simulator for ARM to see if it runs... NO JIT, and well almost any interesting feature is disabled, but I find it more stable.... :???:

I assume you are displaying video out through X11?
don't do today what you can put off until tomorrow.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

[quote]I assume you are displaying video out through X11?/quote]

I'm running Ubuntu with Unity, so yes it runs on X11, but BasiliskII is running on SDL video. Which I guess runs on top of X11.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

Ok, I built Basilik II on 64 Bit Intel Ubuntu 12.04 and Slirp has the same trouble, this seem to be a standing issue with Slirp on Linux:
Cat_7 wrote:Hi,

Do you load the module as root and run Basilisk as root?
Is there a specific reason you need to use the sheep_net module? You can also use the slirp networking option.

Edit: I tried building a newer version of the module, including a change proposed on github.
With both the older and newer module (and with slirp networking) Basilisk crashed as soon as I requested an Internet page. This is using Ubuntu 14.04 LTS.
It might be best if you raised an issue on github.

Best,
Cat_7
http://www.emaculation.com/forum/viewto ... f=6&t=8418

I was able to get some more usefull debug info:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff2057700 (LWP 30413)]
0x00000000780b9a43 in tcp_reass (tp=0x7fffd8001700, ti=0xd8001700, 
    m=<optimized out>) at ../slirp/tcp_input.c:201
201		if (ti == (struct tcpiphdr *)tp || ti->ti_seq != tp->rcv_nxt)
(gdb) bt
#0  0x00000000780b9a43 in tcp_reass (tp=0x7fffd8001700, ti=0xd8001700, 
    m=<optimized out>) at ../slirp/tcp_input.c:201
#1  0x00000000780bb0d8 in tcp_input (m=0x7fffd8000fe0, iphlen=<optimized out>, 
    inso=<optimized out>) at ../slirp/tcp_input.c:1058
#2  0x00000000780738ac in slirp_receive_func (arg=<optimized out>)
    at ether_unix.cpp:821
#3  0x00007ffff7bc4e9a in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#4  0x00007ffff6c3d73d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x0000000000000000 in ?? ()
So hopefully that tells us something.

I wasn't able to build with -g O0, Basilisk would just quit/crash, so I built with the default -g O2.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

I can confirm that the Sheep_Net driver works over Wifi with a Realtek USB wifi adapter, on 64 Bit Ubuntu 14.10.

I'm posting from iCab 68k.

I just wish Sheep_Net would work with my ChromeBook's Wifi, but no joy, so I hope we can figure out what's wrong with Slirp.
galgot
Granny Smith
Posts: 119
Joined: Thu Feb 13, 2014 3:59 pm

Re: Basilisk II on Arm Ubuntu

Post by galgot »

Hi,
Sorry I took some time to answer. I’ve finally managed to compile the sheep_net driver too on the R-Pi. Was a bit difficult to get the correct linux-headers for my kernel as the last ones are not in the raspbian Wheezy repos. After trying the usuals Debian methods without success , found rpi-source tool to get it installed :
https://github.com/notro/rpi-source/wiki
Works fine:
Image
Did not tried over wifi yet as Raspbian seems to have a problem with my network wifi encryption …
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

Ok, I managed to hack togather some slirp code, that seems to work ok for BII. Like I say, it's a hack, but it seem to work for web browsing in IE 3.01a.


I did have iCab quit on me, but it didn't bring down the whole system, like before, just iCab.


I'm going to try and post from Netscape, and see if that works, then I'll try and uplaod a .patch file, so if anyone else ever needs to use slirp on linux, or someone with programing skills greater than mine wants to fix slirp, they'll know where to look.


The main problem seems to be in the file slirp/tcp_input.c.
darthnvader
Mac Mechanic
Posts: 178
Joined: Sun Feb 07, 2016 4:40 pm

Re: Basilisk II on Arm Ubuntu

Post by darthnvader »

OK, I tested Netscape, and it gave me an Illegal Operation error, so this patch still needs some work, but it seem to work fine with IE.

https://drive.google.com/file/d/0B9sU4v ... sp=sharing

Place the patch in the same dir as your macemu folder and:

Code: Select all

cd /macemu/BasiliskII/src/slirp
patch -p1 < ../../../slirp.patch
Hopefully, someone with better programming skills can fix slirp the right way, it is broken on Linux( x86/Arm ) and OS X, in BasiliskII, but the same code works with SheepShaver.
User avatar
rickyzhang
Apple Corer
Posts: 205
Joined: Mon Sep 15, 2014 7:59 pm

Re: Basilisk II on Arm Ubuntu

Post by rickyzhang »

slirp module dones't work for 64bit compiler. If you have 64bit ARM like Qualcomm dragonboard, you need to switch to sheep-net module.
There is an App for that!
https://github.com/rickyzhang82
vasi
Tinkerer
Posts: 54
Joined: Mon Feb 23, 2009 11:46 pm

Re: Basilisk II on Arm Ubuntu

Post by vasi »

rickyzhang wrote:slirp module dones't work for 64bit compiler. If you have 64bit ARM like Qualcomm dragonboard, you need to switch to sheep-net module.
You could also just build a 32-bit version, it should run fine in multilib (32-bit compat layer in Ubuntu).
Post Reply