6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun May 12, 2024 1:56 am

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Sun Nov 28, 2004 6:44 am 
Offline

Joined: Mon Aug 02, 2004 10:24 am
Posts: 3
Can Linux running on 6502?
I think it can ,but i don't know if it will support mult-thread......

If the Kernel do not support 6502 , how to change the Kernel File to support it ?

Thanks for your help.

_________________
I am a Chinese~


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 29, 2004 9:17 am 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
Compared to the Intel x86 processor normally used to run Linux a 6502 is very limited. It has a small fixed stack, a slow clock speed, small memory addressing range and no support for memory protection.

It might be possible to implement a small number of 'Linux'-like operating system functions but it is not powerful enough to implement a proper kernel.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Nov 29, 2004 6:40 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
Can you tell us some of the requirements of Linux? How much stack space would it need? The 6502's hardware stack is limited to 256 bytes which some people think sounds awfully small; but when I wrote my Forth for the 65816 which can use tens of thousands of bytes for the hardware stack, I still used only page 1 (256 bytes) because it's more than I needed. In fact 256 bytes is enough to run at least three tasks at once with no worries of running out of stack space.

As for memory requirements, how does Linux (which I understand was written non-commercially) compare to common bloatware which requires tens of megabytes to run something that could run with under 100K if programmers weren't so careless with the resources and weren't always under pressure to get things to market before they've had reasonable time to do it right? The 65816 addresses 16MB (256 times as much as the 6502's 64KB). I have no doubt that 16MB would be far more than enough for Linux with good programming practices. The same goes for 16MHz clock speed which gives about 3MIPS while handling 16 bits at once instead of 8.

GEOS was available for the Commodore 64 (whose processor was essentially a 6502). Due to the slow disc drive interface, it kind of tried your patience; but the C64 could initially load GEOS and get into a useful application in less time than it takes my Pentium to load Windoze and get into a useful application. I understand there was a 512KB plug-in RAM module that used DMA that would speed up the C64's GEOS by a factor of anywhere from 10 to 100 times.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 02, 2004 11:32 am 
Offline

Joined: Tue Sep 07, 2004 10:14 am
Posts: 2
I think its not possible to port Linux on a 6502, maybe Minix could be used as a base for a port. As far as I know (??), early versions of Minix did not require
an MMU.
But check out the LUnix Project, its a kind of unix for c64 and c128 from
scratch, ports to other systems should be possible:

http://lng.sourceforge.net/

best regards, b0rje


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 6:51 pm 
Offline

Joined: Wed Dec 18, 2002 3:20 am
Posts: 113
if you could get the source to GNO (www.gno.org) - that might also be a good starting point. Granted, it was written for the 65816 and a lot more memory then the 6502 has, but it might provide some ideas at least... that is assuming you can get the source, I never contacted the authors to ask.

_________________
-Tony
KG4WFX


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu May 05, 2005 9:33 pm 
Offline

Joined: Wed Mar 24, 2004 6:32 pm
Posts: 59
Location: Bay Area, CA
The problem is that GNO/ME is pretty bound up to GS/OS. So I'm not sure if the code would help you that much, because it was mostly a unix-like operating system wrapper over the existing operating system.

Minix is a nice idea, but it was designed for a machine with a 20 bit address space. Which then means that you need a 65816 instead.

I think that porting Unix/Linux/etc. to the 6502 or even 65816 is of the those crazy projects. If you want a usable Unix port, you'd probably build a 68k or ARM computer instead of a 6502/65816... both of which have versions that could be done by a hobyist. If you want a nice easy OS for the 6502 or 65816, there's stuff like Contiki. But if you try to make Unix or a Unix-like OS for the 6502 or 65816, your project is going to be to put an OS on a weird platform.... it's going to be a challenge, not a way to make your life easier.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed May 25, 2005 12:10 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
It is certainly possible to implement "Unix", the API, on a 6502. Indeed, the world's first versions of Unix all ran on PDP-6s, with less than 64KB of memory capacity total. However, it executed a very, very limited set of programs concurrently, and wasn't really all that more powerful than, say, MP/M or CP/M. Remember that Unix (formerly named Unics) was the "single-user" version of Multics, created out of frustration from those who participated in the project from AT&T. It was never intended to be the mainframe-class behemoth it currently is today.

It is also possible to implement a Linux-clone for the 65816. However, again, you'll need an out-board MMU to support the multiple address spaces required by Linux. This means you MUST use a 65816, since the 65816 has full hardware-level support for external MMU circuitry.

The best bet is to employ a variation of Minix, preferably one built on a proper and fully orthogonal microkernel (Minix is microkernel based, but it's intertwined with the Unix environment it provides, thus reducing the benefits of such an architecture). Again, a 65816 would be required for the memory requirements. Expect a minimum memory requirement of 256KB (as demonstrated by the Amiga 1000 when it first shipped).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jul 14, 2005 8:44 pm 
Offline

Joined: Wed Feb 09, 2005 2:24 pm
Posts: 6
Location: China Mainland
Some versions of Linux for embeded applications needn't MMU


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jul 14, 2005 8:54 pm 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
ninja wrote:
Some versions of Linux for embeded applications needn't MMU


Again, the choice of and the number of applications that you can run are very limited. And Linux certainly will not fit in the paltry 64KB address space that 6502 provide.s You'll need *at least* a 65816 with 256K of memory.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 15, 2005 4:52 am 
Offline

Joined: Fri Aug 30, 2002 2:05 pm
Posts: 347
Location: UK
Quote:
Can Linux running on 6502?
I think it can ,but i don't know if it will support mult-thread......

Perhaps this is what you're looking for ..

http://lng.sourceforge.net/

Lee.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Aug 11, 2005 2:17 am 
Offline

Joined: Wed Jul 20, 2005 11:08 pm
Posts: 53
Location: Hawaii
Maybe we should try Minix 1.0.0 on 65816 (It's 16-bit, so it should be easier then Linux). As soon as I get an Apple ][gs emulator, I'll try to port Minix to it.

_________________
Sam

---
"OK, let's see, A0 on the 6502 goes to the ROM. Now where was that reset vector?"


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 28, 2023 5:39 am 
Offline

Joined: Mon May 01, 2017 7:13 am
Posts: 82
Necro'ing a dead thread just to demonstrate how common wisdom can be wrong. "But does it run Linux?" can now be finally and affirmatively answered for the 6502, running for example on the Commodore C64. It runs extremely slowly and it needs a RAM Expansion Unit (REU), as there is no chance to fit it all into just 64KiB. It even emulates virtual memory with an MMU. The screenshots took VICE a couple hours in "warp mode" (activate it with Alt-W) to generate. So, as is, a real C64 should be able to boot Linux within a week or so. https://github.com/onnokort/semu-c64


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 28, 2023 6:52 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
Just to note, you also started a new thread:
Linux now running on the 6502


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: