Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Hardware Hacking Software Linux Build

GNU/Linux Running On An 8-Bit Processor 361

dartttt writes, quoting Ubuntu Vibe: "Dmitry Grinberg has successfully booted Ubuntu 9.04 on an 8 bit micro machine with 6.5 KHz CPU and 16 MB RAM. Grinberg did this experiment on a ATmega1284p, 8-bit RISC microcontroller clocked at 24MHz and equipped with 16KB of SRAM and 128KB of flash storage. Since the RAM was too low, he added 30-pin 16MB SIMM to the machine and a 1 GB SD card to host Ubuntu image. ... To get the world's slowest Linux Computer running, he had to write an ARMv5 emulator which supports a 32bit processor and MMU. A similar machine can be made very easily and everything should come in about $20." There is source code available, but it's under a non-commercial use only license. Just how slow is it? "It takes about 2 hours to boot to bash prompt ('init=/bin/bash' kernel command line). Then 4 more hours to boot up the entire Ubuntu ('exec init' and then login). Starting X takes a lot longer. The effective emulated CPU speed is about 6.5KHz, which is on par with what you'd expect emulating a 32-bit CPU & MMU on a measly 8-bit micro. Curiously enough, once booted, the system is somewhat usable. You can type a command and get a reply within a minute." If you like watching a whole lot of nothing, there's a video of the boot process below the fold.

This discussion has been archived. No new comments can be posted.

GNU/Linux Running On An 8-Bit Processor

Comments Filter:
  • Why? (Score:3, Insightful)

    by Anonymous Coward on Monday April 02, 2012 @04:04PM (#39552637)

    Why?

    • Re:Why? (Score:5, Insightful)

      by Penguinisto ( 415985 ) on Monday April 02, 2012 @04:15PM (#39552801) Journal

      Why not?

      Seriously... the skills and knowledge can come in handy someday.

      Maybe someone desperately needs to retrofit modern code to crappy old equipment? Maybe the ultra low power requirements of an extreme low-end machine makes this a fit somewhere?

      Most importantly though, he did it because he could. Doing it puts his skill set far above that of most people, and having that on the resume would get him in good with nearly any semiconductor corp on the planet that needs a software or firmware developer.

      • by BigFire ( 13822 )

        It would come in handy when we decided to retroactively upgrade that space probe we send out 30 years ago. Failure to upgrade the OS on that baby will result in the end of Earth as we know it. Hey, it could happen.

      • Re:Why? (Score:5, Funny)

        by SomePgmr ( 2021234 ) on Monday April 02, 2012 @04:28PM (#39552975) Homepage

        Just ignore the trolls. ;)

        "Why do you want to climb Mount Everest?"

        "Because it's there" ~ George Mallory

      • Re: (Score:2, Interesting)

        by war4peace ( 1628283 )

        Most importantly though, he did it because he could.

        That's the same reason dogs have when licking their balls.
        Just sayin'...

        • by pspahn ( 1175617 )

          And you know how when a V of geese flies overhead, there is often a side that is longer than the other?

          It's because there's more geese on that side.

          Sometimes things don't need explanation.

      • by nurb432 ( 527695 )

        I can think of several reasons for 'why not'.

        The most obvious is that for a processor of that caliber, there are much better operating systems available that exist today. Spending time with one of those would be a far more valuable use of time.

      • Re:Why? (Score:5, Insightful)

        by jd ( 1658 ) <imipak@ y a hoo.com> on Monday April 02, 2012 @04:42PM (#39553149) Homepage Journal

        Alternatively, someone might want to design a new 8-bit CPU for certain embedded tasks where it's essential for there to be low power consumption and a high-end sophisticated OS. There are plenty of extremely slow mechanical operations (combine harvesting, for example) where millisecond responses are not going to be useful but where the complexity of the problem (varying evenness of the ground, varying field shapes, etc) mean you do want to be able to handle many different types of sensor, sophisticated algorithms, etc, within something that needs to be extremely cheap to build/replace and extremely low power to run to be more cost-efficient than having a farmhand (who is likely to be earning minimum wage or below).

        Another option is a System-on-a-Chip. At present, SoC runs into all kinds of problems because of the compromises you have to make to fit everything into one die. If you can reduce the transistors of the CPU component, you can increase the transistors somewhere else, which means this knowledge increases your flexibility in such systems. That's extremely valuable to know, even if you never go to this extreme.

        For deep space probes, radiation is a major concern. Well, for anything in space it's a major concern, but the deeper you go into space the nastier the radiation. It's why the highest-end space-rated CPUs are so primitive compared to commercial CPUs. Being able to reduce the complexity of the CPU and utilize the extra space for redundancy, without reducing the sort of complexity of software the CPU will run, is great news for anyone wanting to rival the Pioneer 10 & 11/Voyager 1 & 2 missions in terms of longevity whilst equally wanting to match Deep Space 1 or the Mars Rovers in terms of flexibility. Knowing that you don't strictly need a 32-bit architecture to run Linux and that you can slice out huge chunks of the architecture gives you tremendous power.

        • Re:Why? (Score:5, Insightful)

          by batkiwi ( 137781 ) on Monday April 02, 2012 @06:25PM (#39554323)

          The question is not "why make an 8-bit cpu and run stuff on it". The question is "why load linux on an 8-bit cpu where it's unusable?".

          There are tons of embedded 8 bit processors, and all can run very complex software written in c/c++/etc.

          I think this is cool, but the answer is simply "as a challenge." The microcontroller problem, and making it either powerful or easy to use, has been solved for years and is evolving. Running linux on them was never what was holding them back.

          • by AmiMoJo ( 196126 )

            Try looking at the parts rather than the whole. He has a working ARM emulator with MMU. The AVR is connected to a large SD RAM module. Enough hardware is emulated to allow Linux to boot.

            Getting to the moon turned out not to be a particularly useful capability but many of the component parts developed to do it were well worth having.

        • Alternatively, someone might want to design a new 8-bit CPU for certain embedded tasks where it's essential for there to be low power consumption and a high-end sophisticated OS.

          The one thing you don't put in a system with a tight power envelope is an emulation layer. I doubt that has any practical application, but it is cool.

    • 6.5KHz, I am impressed, boot times should be..... glacial.

      • Re:Why? (Score:5, Interesting)

        by dmitrygr ( 736758 ) <dmitrygr@gmail.com> on Monday April 02, 2012 @05:08PM (#39553433) Homepage
        It's up to 10 KHz now that i've optimized RAM access (new code up later today)
        • Re:Why? (Score:4, Insightful)

          by hamster_nz ( 656572 ) on Monday April 02, 2012 @08:27PM (#39555349)

          I think your project is really great.

          You will have learnt so much about the ARM architecture, and have a really good view of how things really work. I'm pretty sure that if you got your hands on an FPGA board you now have the skills to make your own ARM processor.

          This puts you head and shoulder above lot of the 'ubergeeks' that lurk on Slashdot discussing how they can get another 1% from their shiny purple Corsair RAM - they just don't get it!

    • Re:Why? (Score:5, Informative)

      by dmitrygr ( 736758 ) <dmitrygr@gmail.com> on Monday April 02, 2012 @05:05PM (#39553401) Homepage
      I was bored :)
    • Re:Why? (Score:5, Funny)

      by hamster_nz ( 656572 ) on Monday April 02, 2012 @08:28PM (#39555355)

      He was waiting for his Raspberry Pi to arrive, so had time to kill.

  • by Anonymous Coward on Monday April 02, 2012 @04:07PM (#39552669)

    They'll submit "FIRST POST"

  • by PPH ( 736903 ) on Monday April 02, 2012 @04:07PM (#39552671)

    ... build a Beowulf cluster of these!

  • But was there a point to this?

    • You can ask the same of most hobbies. I would assume it's mainly for personal enjoyment.
      • by fliptout ( 9217 ) on Monday April 02, 2012 @04:44PM (#39553175) Homepage

        If your hobby is 'waiting for stuff to happen', then this is a great project to undertake.

      • Re: (Score:2, Informative)

        by billcopc ( 196330 )

        Well, I hope the guy got plenty of "personal enjoyment" because I think it's a lame hack. He didn't actually get Linux working on an 8-bit processor. He got it working in an emulator, which apparently he DID write. At no point did he port the Linux kernel to a new platform. This is right up there with booting Linux on a GP2X console via Bochs.

        So, to recaption this article:

        "ARMv5 emu for underpowered and rarely used AVR chip. ATmega community baffled and bewildered. Oh, and it boots Linux in half a day

    • by jd ( 1658 ) <imipak@ y a hoo.com> on Monday April 02, 2012 @04:52PM (#39553261) Homepage Journal

      To this project or to this discovery? To the project, probably no. Well, other than being excellent practice in problem-solving. To the discovery, probably yes. There have long been arguments over the minimum complexity requirements for a general-purpose OS, which is an important problem to solve as complexity is a governor of many things (cost, durability, power requirements, heat generation, etc). We already know from Turing that any CPU can run any software for any other CPU, provided the memory is available and the CPUs are Turing Machine equivalents. What we've been less clear on is what this means in practice, how to exploit it, and whether architectural limitations violate the Turing Machine equivalency requirement. We now have numbers to work with, a case study, and a proof by example that equivalency is satisfied.

  • My 0.02 (Score:4, Insightful)

    by DaMattster ( 977781 ) on Monday April 02, 2012 @04:10PM (#39552701)
    On one level this shows just how clever Dmitry is and it shows excellent problem solving skills. However, I would be more impressed if he could do something interesting with more modern technology. The technical challenges of booting a modern OS on dinosaur hardware are amazing and if he could take his innovation ability and apply it to state of the art technology, image what he could achieve.
    • On one level this shows just how clever Dmitry is and it shows excellent problem solving skills. However, I would be more impressed if he could do something interesting with more modern technology. The technical challenges of booting a modern OS on dinosaur hardware are amazing and if he could take his innovation ability and apply it to state of the art technology, image what he could achieve.

      It's called a "hobby project"; you might have heard the term "hobby" on occasion - people occasionally do not-necessarily-useful-in-the-Real-World(TM) things as hobbies, such as getting old {radios, cars, airplanes, computers, etc.} to work, because it's fun for them.

      If you're curious what he achieves when he's not working on his hobbies, you might want to check his [dmitry.co] work [dmitry.co] pages [dmitry.co], which are linked to from the sidebar on the site to which the article refers.

    • Re:My 0.02 (Score:5, Funny)

      by dmitrygr ( 736758 ) <dmitrygr@gmail.com> on Monday April 02, 2012 @05:22PM (#39553559) Homepage
      I do plenty of other things (flying planes, collecting speeding tickets, etc). This was just for fun. And it was quite fun. I never expected it to be fast enough to use, and am still quite amazed that it is usable (for some definitions of "usable")
  • Geoworks (Score:5, Informative)

    by Daniel Phillips ( 238627 ) on Monday April 02, 2012 @04:10PM (#39552707)

    Nice trick. However, let me point out that in 1990 Geoworks GEOS was capable of running a preemptive multitasking GUI looking much like QT but with better automatic widget layout, on an 8 MHz 8088. I will just heave a great sigh in the name of the lost art of tight coding. No, Linux is not tightly coded. I should know. The best you can say about it is, the other guys are worse.

    • Re:Geoworks (Score:5, Interesting)

      by Ichijo ( 607641 ) on Monday April 02, 2012 @04:20PM (#39552865) Journal

      No, Linux is not tightly coded. I should know. The best you can say about it is, the other guys are worse.

      Not MenuetOS [menuetos.net]. It's an operating system with a graphical UI, pre-emptive multitasking, and USB and TCP/IP stacks that boots from a single floppy.

    • Re:Geoworks (Score:4, Insightful)

      by jellomizer ( 103300 ) on Monday April 02, 2012 @04:21PM (#39552881)
      My old stuff works so much better then my new stuff...%#@&*&(@+++ NO CARRIER Sorry Computer crashed. Because old software was so optimized... $#@%^^++ NO CARRIER For the old equipment. The only trade off was fault tolerance.

      You will not believe how much Computing power goes to making sure your computer doesn't crash every day.

      Back in the old days computers crashed much more then it does now. And it isn't that they are better programmers but more to the fact that there was a trade off on how much code in the back end needed to be done to protect the system.
    • Re:Geoworks (Score:4, Informative)

      by kimvette ( 919543 ) on Monday April 02, 2012 @04:26PM (#39552949) Homepage Journal

      Nice trick with Geoworks, but the 8088 is a 16-bit processor on an 8-bit bus.

      Now, GEOS (the predecessor to Geoworks) did run on 8-bit procesors in the '80s, but it was in no way multitasking.

    • Nice trick. However, let me point out that in 1990 Geoworks GEOS was capable of running a preemptive multitasking GUI looking much like QT but with better automatic widget layout, on an 8 MHz 8088. I will just heave a great sigh in the name of the lost art of tight coding. No, Linux is not tightly coded. I should know. The best you can say about it is, the other guys are worse.

      "better automatic widget layout" - this made my day. I remember using GEOS as a boy, on a C64. It was a lot of fun going from text menus to an actual mouse-relevant UI, but sophisticated it was NOT. Automatic widget layout? There were 8 icons per window and if you didn't like where they were you could (a)bort, (r)etry, (i)gnore.

      • That was a limitation of the C64 video chip. Only 2 colors were allowed per 8x8 square, so any attempt to move the icons would have led to a graphical mess (like macroblocking in heavy-compressed video).

        In order to avoid that mess, GEOS assigned every icon to a fixed location. It was intended to fit inside just 0.06 meg of RAM, not to be fancy. (For contrast the Mac OS ran in 0.5 meg of RAM.)

    • My first and lasting impression of GEOS was how fast it felt. Everything I clicked on seemed instantaenous. Despite the massive advances in technology, I've yet to experience another GUI as responsive as that.
    • Re:Geoworks (Score:5, Informative)

      by david.given ( 6740 ) <dg@cowlark.com> on Monday April 02, 2012 @07:07PM (#39554809) Homepage Journal

      I wrote some code for it: see here [cowlark.com] (including a Linux86 execution environment, that would allow you to directly run Linux86 binaries from GEOS, that I was really rather proud of).

      I can sum up the coding experience with the phrase: THE HORROR, THE HORROR.

      In order to write code for GEOS you needed a monster, badly written and badly documented SDK and a copy of Borland C. The actual code you wrote was in a C superset called GOC, which was compiled via a buggy preprocessor into incredibly cryptic C, which was then compiled with Borland and linked with a custom linker. Alternatively, if C wasn't your thing, there was an object-oriented dialect of 8086 assembler available. The OO system was bizarre, and allowed for classes to have unspecified superclasses, where the superclass was determined at run time: the system used this to great effect in the UI, where the app author's generic UI was turned into a specific UI implementation for the device. The C bindings were full of bugs, too, including function calls which didn't save all the registers properly...

      The actual architecture exploited the hell out of the 8086 segmentation architecture. Memory was organised as a set of relocatable blocks which were referred to by handles (which, under the hood, were usually segment descriptors). To dereference the memory, you had to lock the block, do your manipulation, then mark the block as dirty if you had changed it, and unlock it. The lock/unlock procedure allowed the system to ensure that the block was in memory, by paging it in if necessary, either from EMS RAM or disk. It was incredibly, utterly, un-Posix, and a complete pain to do anything in. The learning curve was insane.

      Where GEOS really did well was the application stack, which was subtle and elegant. There was a mechanism to allow you to use a file as a heap backing store (using a very similar but annoyingly different API to the block API described above, but that's not really important). The system automagically loaded and saved data from the file as you locked and unlocked blocks. There were standard components for everything up to and including a complete bitmap paint package, a vector drawing package, and a word processor --- and these all used these file heaps as storage. And, of course, you could have multiple components in the same file. OLE! But done right.

      By today's standards, of course, it's all a huge pile of incomprehensible, unmaintainable cruft, all inextricably linked to 16-bit 8086 code. It wasn't just utter mismarketing that killed GEOS: it was the inexorable march of time. It was simply unable to adapt to the 32-bit world. All the clever tricks they did to get decent performance out of an 8086 were liabilities on more modern hardware.

      That said, towards the end, when Geoworks was in its death spiral, they did produce two different attempts to rewrite GEOS for 32-bit RISC processors: GEOS-SE and GEOS-SC. I know absolutely nothing about these other than on the wikipedia page, and if anyone has any info, I'd be fascinated to hear about it.

      • Interesting. I did a little bit of coding to the GEOS API as well, not much more than building their hello world application, whatever that was. I noticed that the SDK itself would tend to crash if you looked at it sideways. I think the SDK ran on a Sun 1, I could be wrong about that.

        As far as the segment architecture goes, I did a similar thing myself with the 8086 segment architecture, which extended to the 286 protected mode model nicely, and also worked fine on 386, still using the 286 memory model but

  • This whole project, while seemingly pointless, seems pretty damn interesting to me.

    Question for Linux hackers: is there a reason why the Linux kernel would not be portable to an Atmel AVR microcontroller?

    • by alexru ( 997870 )

      Question for Linux hackers: is there a reason why the Linux kernel would not be portable to an Atmel AVR microcontroller?

      Linux requires MMU and AVRs don't have it. Memory limitations will kick in as well (the most powerful AVR has 256 kB of flash ans 32 kB of RAM, so external storage will be required)

  • An ARM emulator running on an 8-bit microcontroller.

    Alan Turing [wikipedia.org] strikes again!
  • by Qubit ( 100461 ) on Monday April 02, 2012 @04:25PM (#39552935) Homepage Journal

    ...oh wait, I see what you did there.

  • DMV (Score:5, Funny)

    by j00r0m4nc3r ( 959816 ) on Monday April 02, 2012 @04:26PM (#39552953)
    Let me guess, the DMV ordered 1000 copies..?
  • by DarthVain ( 724186 ) on Monday April 02, 2012 @04:27PM (#39552963)

    "slowest Linux Computer running"...

    I beat that score by a large margin. Years ago I took an old 386 Laptop that ran at 25Mhz, I don't recall how much ram it had, but I am going to go with "not much", and booted DSL (Damn Small Linux) in just over 21 hours. Which is over 10x as slow as the one in the article! So technically I think I had the "slowest Linux computer".

    Why did it boot so slow? Well it was also the reason I used DSL, because it was less than 50MB, and I could fit it on a Zip drive. Attached via a parallel cable. It did work, and it did eventually boot, however I had to leave it over night (I thought it would eventually just crash), but it worked its way through. Also on a fun note, when typing and executing commands it was like telneting to the moon, there was like a 4-5 second delay between typing any command hitting execute, and any sort of result. I really just wanted to see if it was possible to install and run an OS on a zip drive connected via a parallel port. The answer is yes, but not very well.

    • Now that I think about it, I think the laptops hard drive was also so small that even DSL was much too large for it. It probably only had a 20MB hard dive in the thing, which would have made it necessary to try the zip drive thing at all if I wanted to use it as a linux machine. I think that necessity is what gave me the idea. Had a useless piece of hardware sitting around that I thought might be useful for something if I could get Linux on it. Turns out I was wrong... Still useless... :)

  • When can I expect a Commodore 64 port?
  • Was a Packard Bell Legend 70 CD Supreme (haha)

    was a 75 mhz, 8 meg ram, had a 4x cdrom (hence the cd supreme) it came with windows 3.11 on it and used trumpet winsock to get online.

    I formatted it and installed Slackware Linux I got from a CD inside a book at "Waldenbooks" store I had bought on linux. I think it was somewhere around 2.0.20 - 2.0.29 era linux kernel.

    Anyhow slackware on a 75mhz/8 meg ram was much much more fun and easier getting online than dealing with win 3.11 and trumpet winsock. I was

  • by Guy Harris ( 3803 ) <guy@alum.mit.edu> on Monday April 02, 2012 @04:32PM (#39553043)

    That's how this is best thought of. In effect, he used an AVR chip as the microengine for a vertically-microcoded implementation of ARMv5, with some extensions. It's not as if Linux is running natively on an 8-bit architecture; that's be like saying, for example, that when OS/360 was running on a 90-bit-instruction/32-bit data VLIWish Harvard architecture machine when it's running on a System/360 Model 50.

  • I've worked as a logic monkey building CPUs in the past - this is SOP in our world - we'd boot linux on our hardware on the verilog simulator as part of our QA - 2 hours is nothing .....

    It's not even a new idea 20 years ago I used to port Unix for a living (no linux yet), when the early RISCs came out they came with architectural simulators, while waiting for real silicon we'd spend the time bringing the kernel (and compiler) up

  • Does it run netBSD?

  • by rnturn ( 11092 ) on Monday April 02, 2012 @06:16PM (#39554207)

    ... install Linux on a '486 system with a mere 16MB of RAM? I still recall how POed I was when I needed to borrow RAM frmo another system to install Red Hat because the new Anaconda required 32MB. (Because, you know, all that additional memory was required for that slide show showing you all the cool features that you were probably going to be too lazy to read about.)

One man's constant is another man's variable. -- A.J. Perlis

Working...