Linux on NeXT hardware

NeXT Computer, Inc. -> NeXT Black Hardware

Title: Linux on NeXT hardware
Post by: ramalhais on September 24, 2022, 08:21:51 AM
Hi!
I picked up an old Linux 2.1 port for the NeXT, ported it to Linux 6.0-rc6 and have it working on all NeXT variants on Previous (emulator).

Currently, only the framebuffer and keyboard work:
https://github.com/ramalhais/linux/releases/tag/NeXT-2022-09-24-03.03.43

Let me know how it goes if you try it on real hardware.
Title: Re: Linux on NeXT hardware
Post by: barcher174 on September 24, 2022, 02:43:23 PM
Wow, thats impressive. What was the effort required?
Title: Re: Linux on NeXT hardware
Post by: ramalhais on September 24, 2022, 05:29:39 PM
Quote from: barcher174 on September 24, 2022, 02:43:23 PMWow, thats impressive. What was the effort required?

It was not easy, but i learned a lot. I did it this month of September on my spare time.
Title: Re: Linux on NeXT hardware
Post by: Rob Blessin Black Hole on September 24, 2022, 06:41:37 PM
Totally cool , nice work I'll give it a try ! 

So I'm trying to envision this so Previous running on my Mac Mini ,  To get Linux running first sounds a bit complicated , I'll try

and we will probably need NeXT mouse driver foo lol ,

I wonder if there is an ADB mouse and Keyboard driver for Linux that would work for the NeXT Turbo V74 Rom Configuration which supports ADB ?

looks like this doc has clues on ADB for Linux https://sixfab.com/wp-content/uploads/2021/02/Telit_Modules_Linux_USB_Drivers_User_Guide_r9.pdf

Driver kit for NeXT may help in writing Linux Drivers https://www.nextcomputers.org/NeXTfiles/Docs/NeXTStep/3.3/nd/OperatingSystem/Part3_DriverKit/Concepts/1_Overview/Overview.htmld/index.html although it describes NeXTSTEP Intel drivers , how the heck does create  NeXT 68K driver?

 It would be  cool eventually to create a NeXT Linux App exactly like DayDream Darkmatter which boots Mac OS on NeXT Hardware which would reboot into Linux :)   Or an App like Soft PC or Executor which would let you run Linux apps in emulation on NeXT 68K hardware ?   

Is it also possible to use the Linux port to create a bootable fully compiled NeXT68KLinux iso  where you would simply be able to install it , now that would be fun .  A boot manager like partition manager so you would be able to chose the OS  , Previous may make this possible but it would be awesome to see it running on NeXT 68K   then a  hybrid GNUSTEP  Linux 68K hybrid  may warp out of the reality distortion field.
Title: Re: Linux on NeXT hardware
Post by: ramalhais on September 25, 2022, 12:09:36 PM
Quote from: Rob Blessin Black Hole on September 24, 2022, 06:41:37 PMTotally cool , nice work I'll give it a try ! 

So I'm trying to envision this so Previous running on my Mac Mini ,  To get Linux running first sounds a bit complicated , I'll try

and we will probably need NeXT mouse driver foo lol ,

I wonder if there is an ADB mouse and Keyboard driver for Linux that would work for the NeXT Turbo V74 Rom Configuration which supports ADB ?

looks like this doc has clues on ADB for Linux https://sixfab.com/wp-content/uploads/2021/02/Telit_Modules_Linux_USB_Drivers_User_Guide_r9.pdf

Driver kit for NeXT may help in writing Linux Drivers https://www.nextcomputers.org/NeXTfiles/Docs/NeXTStep/3.3/nd/OperatingSystem/Part3_DriverKit/Concepts/1_Overview/Overview.htmld/index.html although it describes NeXTSTEP Intel drivers , how the heck does create  NeXT 68K driver?

 It would be  cool eventually to create a NeXT Linux App exactly like DayDream Darkmatter which boots Mac OS on NeXT Hardware which would reboot into Linux :)   Or an App like Soft PC or Executor which would let you run Linux apps in emulation on NeXT 68K hardware ?   

Is it also possible to use the Linux port to create a bootable fully compiled NeXT68KLinux iso  where you would simply be able to install it , now that would be fun .  A boot manager like partition manager so you would be able to chose the OS  , Previous may make this possible but it would be awesome to see it running on NeXT 68K   then a  hybrid GNUSTEP  Linux 68K hybrid  may warp out of the reality distortion field.

If you're going to use Previous emulator, it will probably emulate the old style keyboards, so you can use any keyboard supported on the host running Previous.

BTW my changes are based on Zach Brown's port from 2000:
https://web.archive.org/web/20041009152212/http://www.zabbo.net/nextlinux/
Title: Re: Linux on NeXT hardware
Post by: eagle on September 26, 2022, 08:59:48 AM
Wait, just to make sure I'm understanding you... you took the old Linux m68k NeXT port and upgraded the kernel, and you're running that in Previous on a newer Mac/Windows system?  That's so cool.
Title: Re: Linux on NeXT hardware
Post by: ramalhais on September 28, 2022, 08:22:01 PM
We now have mouse, ethernet (except Turbo machines), and NFS working:
https://github.com/ramalhais/linux/releases/tag/build%2F2022-09-29-01.38.27_6.0.0-rc7_15380a2d84505779653afd66cc8d29f61fac8c1e
Title: Re: Linux on NeXT hardware
Post by: ramalhais on October 05, 2022, 06:23:54 PM
Quote from: ramalhais on September 28, 2022, 08:22:01 PMWe now have mouse, ethernet (except Turbo machines), and NFS working:
https://github.com/ramalhais/linux/releases/tag/build%2F2022-09-29-01.38.27_6.0.0-rc7_15380a2d84505779653afd66cc8d29f61fac8c1e

NFS is timing out while downloading files. It's probably some issue with the network driver  :'(
Title: Re: Linux on NeXT hardware
Post by: ramalhais on October 26, 2022, 05:11:29 AM
Ethernet now works on Turbos aswell. You need to configure twisted pair in Previous Networking config.
I'm still having some issues using Previous. The VM hangs sometimes while moving the mouse and on high network traffic, so, still no usable NFS. Maybe some IRQ issue.
Title: Re: Linux on NeXT hardware
Post by: eukara on October 26, 2022, 11:35:09 AM
That is so awesome. I'll mess around with it this weekend if I find the time.
Doubt it'll have enough overhead leftover to run X11 and GNUstep, but that'd be incredible.
Title: Re: Linux on NeXT hardware
Post by: ramalhais on November 02, 2022, 02:52:06 PM
Quote from: eukara on October 26, 2022, 11:35:09 AMThat is so awesome. I'll mess around with it this weekend if I find the time.
Doubt it'll have enough overhead leftover to run X11 and GNUstep, but that'd be incredible.

I'm trying to make Xorg work. It starts, but all i get is a black screen and it seems to hang. It may just be the Previous emultator hanging. I have no NeXT hardware :(

EDIT: X is probably going to be slow because it's using fbdev.
I'm now trying to mess with SCSI/previous disk images, so that i don't have the limit of 16MB for the linux+initramfs to keep the files

I'll be glad to help if anyone needs some pointers. Either here or on github(preferably):
https://github.com/ramalhais/linux/discussions
Title: Re: Linux on NeXT hardware
Post by: eukara on November 04, 2022, 04:44:25 PM
How about XFree86? That should in theory still compile and run. It is used on some BSD systems because it's the only one still with some platform glue they need on some architectures I believe.
Title: Re: Linux on NeXT hardware
Post by: ramalhais on November 04, 2022, 05:57:56 PM
Quote from: eukara on November 04, 2022, 04:44:25 PMHow about XFree86? That should in theory still compile and run. It is used on some BSD systems because it's the only one still with some platform glue they need on some architectures I believe.

yep, old software is probably a good fallback since it's usually simpler and smaller, but i have good news: Xorg is running!

I can start xterm, but keyboard and mouse not working. Probably needs some tweaks to the xorg.conf file.

I still get freezes in Previous, even after stopping the ethernet interface (i was assuming it was something with the ethernet IRQs or DMA).
Title: Re: Linux on NeXT hardware
Post by: ramalhais on November 21, 2022, 09:01:36 PM
Good news! SCSI is working!
We can also detect nextstep disklabel partitions and mount nextstep partitions read-only.
Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 21, 2023, 07:25:44 PM
So, i've been busy with a lot of stuff:

- UFS filesystem
Filesystems are hard  :'(  ... linux only supports readonly UFS for the version of UFS used on the NeXT.
Tried to enable write support and KABOOOM.

- NetBSD bootloader with support for ext2 (linux filesystem)
Got it booting in Previous, but only on turbo boards.
After some Previous patches from Andreas it now seems to work on non-turbos aswell.
It can boot an ext2 disk image.

- Creating bootable disk images
NeXT partition label support in linux.
Script to create disk images.
App to write a NeXT disklabel to the image/disk.

- X11/Window managers
Got X11 working with mouse and keyboard.
Still have a bug in Previous where if i have mouse grab enabled, no mouse input gets to linux.
Tried several window managers, but unfortunately most don't work including WindowMaker (NeXTStep lookalike which i really wanted).
I think i got TWM to work, but that's old as hell.
Also, latest X11 and latest window managers use so much memory (huge binaries) that it makes the NeXT slow as hell to load (well, in Previous, not tested on actual hardware yet).
I guess the framebuffer is going to be very slow unless i find a way to accelerate this, like DMA or something.

- Real Hardware:
I have received Rob's donation, a color nextstation 14MB with floppy, and a bare mono board, and been busy trying to get a screen, keyboard input and trying to fix networking that works on Previous but not on the real hardware.

For the screen i tried many things, including custom SCART(EURO-AV) cable, VGA to HDMI converters, nothing worked. I got a bit of image on an old samsung 32in TV via the custom scart cable, but it couldn't handle the sync on green.
In the end i got an old Samsung SyncMaster 710N which supports sync on green.
Works with both the mono and color stations. Still waiting for a 13w3 connector (expensive) and make a 19pin DB connector so that the connections are more reliable.

I got serial console working.
If you don't connect the RTS/CTS lines, you need to disable software flow control on the client (using putty) or you'll get garbled text after the PROM's serial test.
Also had issues with one of the serial to usb adapters CP2102 outputting only garbage.
Had success with an old serial to usb adapter: ATEN UC232A USB to RS-232 Adapter.

I bought some additional memory because it seems like it needs at least 20MB to boot the linux kernel.
Need to look into that. The kernel is only 6MB, it needs a bit to uncompress the initramfs, but it shouldn't be 20MB!
If you live in Europe and can't find reasonably priced 30pin memory, I recomend a guy in france that makes 30pin SIMMS from old 72pin SIMMS: https://www.ebay.es/itm/115420643997

I have also bought a battery for the mono and now both boards boot from the network.

I can get the mono station to a linux shell, but networking and scsi don't work, seems like some issue with accessing memory addresses on the BMAP chip.

The color station starts booting but then the color framebuffer doesn't work, probably related to the same issue with the network and scsi as on the mono.

Also tried to implement something on an ESP32 to implement the monitor (keyboard/mouse/sound) protocol, but i got nowhere, it seems like an ESP32 can't handle the high speed (5mhz?) of the protocol. I got an FPGA to play with and i'm waiting for a logic analyzer, but without a real soundcard, it's going to be tough.
I found the NeXT mouse of my lost nextstation mono, it was in some bag from the last house move.

Also tried to make a DIY SCSI2SD/BlueSCSI based on DietSCSI, but it didn't work (you're going to laugh at my attempt  :-[  ). Ordered some DietSCSI boards from JLCPCB. Basically for 75EUR you get 5 DietSCSI boards. I'll let you know how that went.

Tried to implement something in the linux kernel to overwrite the settings on NVRAM to enable serial console on the mono (it's back to the default settings because it had no battery and i have no soundcard/keyboard), it can write to the NVRAM, but i can't for the life of me get the checksum algorithm to give me a correct checksum, so when the NeXT boots, it resets to defaults again  :'(

I'll post pictures later.
Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 22, 2023, 01:47:39 PM
Damage during shipping. Floppy bracket screws got loose and rammed into the CPU&cooler
https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1u7Yd1OVetahdGzj9D8lQYWQM8EJ4g-DJ%26amp%3Bexport%3Ddownload

Linux Booting:
https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1LhcOWsiswXlHgz7-4uUbs2-3p-50CS98%26amp%3Bexport%3Ddownload

DietSCSI DIY failed attempt (and fire hazzard)
https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1ie64MG-HKPTqJXUvrwrlV3L73JdHuz_k%26amp%3Bexport%3Ddownload

Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 22, 2023, 01:57:49 PM
If anyone dares to try Linux out on their NeXT, here's some 2GB images that you can copy to a SCSI2SD/BlueSCSI SDCard
https://github.com/ramalhais/linux/releases/latest

Just "tar zxvf FILE" to uncompress/untar the file, then move it to the sdcard following the required naming convention.

2GB Disk with NeXT disklabel, NetBSD bootloader, ext2 partition and Linux kernel:  linux-next-2gb-sparse.disk.tar.gz
Like above, but debian bootstrapped: linux-next-2gb-debian-systemd.disk.tar.gz
Like above, but without systemd: linux-next-2gb-debian-sysvinit.disk.tar.gz
Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 22, 2023, 02:04:02 PM
Oh, and the DietSCSI boards just arrived. Need to flash the image to the chip and do some testing, but first i need to be able to write to NVRAM on the NeXT with the right checksum, to be able to boot from SCSI.

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vDRwm4HnkPBZibizhTuiOvjEupY18oP3%26amp%3Bexport%3Ddownload
Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 22, 2023, 02:13:57 PM
And now, onto butchering a perfectly fine 15EUR 13w3 to vga adapter, that probably cost 10cents to manufacture

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vG5StZGBtA7buotkyruRWHqD41pYl6K8%26amp%3Bexport%3Ddownload
Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 22, 2023, 03:56:34 PM
Wow, flashing the firmware onto the DietSCSI was a breeze. 5 working DietSCSIs! (SCSI yet to be tested)

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vQofPn67JbRuXeNN0yFWqa4hVkNFUaZT%26amp%3Bexport%3Ddownload

An advantage of DietSCSI is that you can use USB passthrough mode, connecting to a PC via USB to use the SDCard files as disks, like on SCSI.
https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vS-Hd9OOl_4_JVnZU2-BdQgbsWQa69Za%26amp%3Bexport%3Ddownload
Title: Re: Linux on NeXT hardware
Post by: crimsonRE on March 23, 2023, 12:14:01 PM
Whoa - that poor NeXTstation looks like it is on life support...
Title: Re: Linux on NeXT hardware
Post by: ramalhais on March 23, 2023, 01:52:52 PM
- Added RTC NVRAM fix to linux kernel, to enable serial console, disable power-on tests and disable auto-boot
- DietSCSI is a success
- NetBSD bootloader failed  :o
- 13w3 connector successfuly gutted

First boot attempt from DietSCSI:

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1odyoPs8mH1L-ZQUl2-cbbh9FxjPHa8o5%26amp%3Bexport%3Ddownload

Gutting a 13w3:

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vtRQ4LfKhWROZcLiOLgl9KcUCvIjPP0f%26amp%3Bexport%3Ddownload

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vviVw87Gob1-GWDoEwYW4JmY432GHcRf%26amp%3Bexport%3Ddownload

https%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1vzpeEoMP0anqSLe_4_9OsXVFnBOIag5-%26amp%3Bexport%3Ddownload


Go to top  Forum index