Helping on m68k

Blog post by mmu_man on Sun, 2008-08-03 22:17

As the m68k port is getting shape, maybe some of you want to give a hand, so here is how to set up the environment. After explaining the choice of the target platform we'll start with the build system, then the emulator to debug on the chosen platform.

Why not Macs? I want it on my Amiga! I have a NeXT to give away!

(I wish ;))
The choice of the target platform was actually directed by the available emulators for various m68k machines. QEMU has a m68k target, but it's still only ColdFire, not the real thing. And it doesn't emulate an existing machine.
Most operating systems for the 68k machines from this era had to support cpus ranging from the bare 68000 to 68030. This means most didn't actually use the MMU available on the 030 and later CPU. Actually, many machines were using Low Cost versions like the 68EC030 which lacked either the FPU or the MMU. This was the case of most Amiga models, of course one could add CPU boards with a 040 or 060 to them. But we do need an mmu for Haiku. While I own a Mac LC III which has a full 030, Basilisk II doesn't emulate the MMU as far as I know, because since most Macs didn't have one, MacOS didn't use it anyway, except for swapping when enabled in some versions.
I don't know of any NeXT emulator, but just shout if you do.
Early SUN workstations were also using 68k chips, but with a custom MMU so let's not talk about them.
The Amiga has a well known emulator, UAE, but it doesn't have MMU support either. I heard recent WinUAE does, but I just don't use Windows for real work. But it will probably make a good second candidate for later on. It seems there is even an attempt at creating a new 68K-based Amiga.
There are some other 68k platforms around, like X68000, which a 030 model existed, but they are quite rare. The only common platform left is the Atari Falcon, for which the emulator ARAnyM (for Atari Running on Any Machine) actually provides full 040 emulation, including the MMU. The platform is also much more standardized and documented than Macs, due to the low number of models and being a gaming platform forced Atari to stay hardware compatible with the plain ST, whereas Macs used the ROM and the OS to abstract the hardware which radically changed from one model to the next.

Making a build

It's not much different from a regular x86 build, the only difference being the target architecture. To get the required tools, just follow the Linux guide, then when comes the time of configuring, instead we'll do a

./configure  --build-cross-tools-gcc4 m68k ../buildtools/

This should build the cross compiler and set everything up.
Then just go forward with a

jam -q haiku-image

The kernel isn't fully working yet, but everything should build just fine.

Now we'll also need a bootloader that can be used by the emulator. For now we only target the Atari Falcon. Theoretically, the Falcon should be able to just go ahead and use the BFS boot sector, but at least the emulator doesn't do it, mostly because on most Atari machines harddrive support needs to load drivers first. To make things easier also, the bootloader can be built as a .prg file that can be loaded directly by the emulator. It should be possible to also build a bootable floppy, but it's not yet working, so let's use a .prg, which can also be used on real machines, when put in the AUTO folder.

jam -q haiku.prg

Testing it

Now we'll need something to test this image, and don't expect your laptop to boot it.
First, we'll need a recent ARAnyM, as I fixed an issue with Transparent Translation Register handling, so release version won't work.
We'll just use the CVS version:

cvs -d:pserver:anoncvs@cvs.aranym.org:/var/repos login
cvs -z3 -d:pserver:anoncvs@cvs.aranym.org:/var/repos co aranym
cd aranym
./configure --enable-fullmmu --enable-fullhistory
make

Optionally we can install it, as root:

su
make install

But it can also be run from there with the full path.

We'll also need a ROM to boot. Luckily, Some people reimplemented the full Atari ROM as Free Software, it's named AFROS.
Go download it from here, just follow the link to sourceforge.
Unzip it somewhere. We'll now copy the default configuration file to tweak it, and create a symlink to the haiku.prg we generated earlier.

cd afros-0.9.5
cp config haiku
ln -s /path/to/haiku/trunk/generated/objects/haiku/m68k/release/system/boot/platform/atari_m68k/haiku.prg  system/

Now, edit the file named haiku, and changes matching lines to:

Bootstrap = system/haiku.prg
RedirConsole = Yes

And in the [IDE0] section:

Present = Yes
ByteSwap = Yes
Path = /path/to/haiku/trunk/generated/haiku.image

Now you should be set. To start the emulator, let's try:

/path/to/aranym -c ~/afros-0.9.5/haiku

After a lot of messages, it should present you the familiar boot menu, where you can select the partition to use, and continue booting.
Then it will load the kernel.
I'm still working on getting the kernel on shape, so it won't go far, but feel free to help out.

Comments

Re: Helping on m68k

that one chip amiga those guys are working on looks really promising. And with haiku there would be no workbench (no guru meditations too!). Too bad the german new atari project stalled at 2006. Seems to me that the pocketsize new amiga would be an ideal platform to run the m68k haiku.

Re: Helping on m68k

Maybe a better target would be the Palm platform.

Re: Helping on m68k

The NatAmi project looks like a perfect fit for your Haiku 68k port.

Quote:

The production of first NatAmi60 developer boards is scheduled for Summer 2008.

Developer NatAmi60 board:
NATAMI with below specification
Including 16 MB high performance Chipmem
68060 CPU (up to 90 MHz for CPU and BUS speed)
256 MB Fastmem

NATAMI Specification:

The Natami is no expansion card but a complete computer, compatible with Commodore AMIGA.

GFX: SuperAGA chipset on board
Compatible to AGA but enhancing it.

Supported Resolutions:
320x256 - 1280x1024

Supported Pixelformats:
Planar 1-8 Planes, HAM 6/8, 8bit Chunky, 16bit Hicolor, 32bit Truecolor

Video and VGA:
31kHz VGA:
Analog VGA SUB-D HD15 output
15kHz screens are automatically scandoubled to be displayed both on TV and VGA monitor.
15KHz screens are not atuomaticly flickerfixed as scandoubling looks better for old games and demos.
SVideo:
PAL/NTSC video output through SVideo connector.
15kHz are shown directly without conversion (SVideo quality).
All screens are scaled to 720x512 (or 720x400 on NTSC) as long as the VSYNC is 50/60Hz
corresponding RGB-analog signals may be available on internal (on board) connector.
Genlock:
an SVideo input connector is available also. The background color can be exchanged with this signal.
This feature is not fully implemented as of today.

AUDIO: Paula style sound
4 Voices
From: 8bit Samples x 6 Volume
To: 16bit Samples x 8 Volume
The Natami has HW support for mixing a virtuelly unlimited number of Audio channels.

COPPER: including original AGA copper

BLITTER:
Fully compatible with AGA-AMIGA
Speed of SuperBlitter is many times faster than AMIGA AGA blitter
comparisons will follow.
2D Enhancements:
In Chunky/Hicolor/ or Truecolor pixel mode the Super Blitter can "cookie cut" copy bobs.
Like the AMIGA Sprites, a "cookie cut" copy needs no blitting mask.
This enabled the blitter to use less memory and to work at double speed compared to planar blits.

3D Accelerator:
Texturemapping Blitter enhancement.
Provides Mipmapping, Subpixel 4 way interpolation, Light sources, Antialiasing, Alpha blending.

Amiga backwards Compatible IDE controller supporting PIO and DMA

Amiga Compatible Floppy Disk controller

2 PCI slots onboard to allow later upgrading (3rd available with riser-caard)

CPU on board
68060 CPU on board for instant compatibility with AMIGA software

CPU expansion slot
Allows upgrade to another CPU (Coldfire/PowerPC/Cell)
SLOT layout will be fully documented to allow 3rd party upgrade designs.

New enhanced and performance optimized 68K-CPU planned as free upgrade.
We started work on a new fully compatible 68K CPU, providing high performance for todays multi-media applications.
This CPU will become part of the SuperAGA chipset. Our goal is to make this available as free firmware upgrade for the Natami60 boards.

http://www.natami.net/

Re: Helping on m68k

Nicholas wrote:

The NatAmi project looks like a perfect fit for your Haiku 68k port.

François has already talked to the NatAmi people. Being Amigans they are not intending to include an MMU in the finished product (most Amiga software doesn't use the MMU and so it is seen as unnecessary overhead), so it would not be able to run Haiku if it eventually gets built.

The NatAmi developer board design includes an MMU, but has the additional disadvantage that it's untried hardware. So simultaneously with trying to debug Haiku you'd be trying to debug this new hardware.

Re: Helping on m68k

Ah well, hosted in Aranym-JIT is good enough for now I guess.

Could a port to a Coldfire developer board be a possibility perhaps?

Re: Helping on m68k

you can't use JIT and MMU support together with Aranym.

As for CF, QEMU has some support, it should be possible, but I don't have any hardware with it.

Re: Helping on m68k

I think that the current palm models all run arm now with m68k emulation. It'd be interesting to get an arm port too... But this isn't linux.

Re: Helping on m68k

Palm models were using really low end 68k chips, without mmu, so it wouldn't work.
As for an ARM port, watch out.

Re: Helping on m68k

when you said "As for an ARM port, watch out."

does that mean it is a possiblility? .... hmmm beagleboard & pandora running Haiku?

Re: Helping on m68k

I have an accelerated Falcon 030 with 14mb of ST RAM. What are the chances of getting haiku running on it?