[HN Gopher] Linux 5.0 shown to boot on ESP32 processor
___________________________________________________________________
Linux 5.0 shown to boot on ESP32 processor
Author : MrBuddyCasino
Score : 151 points
Date : 2021-07-19 19:04 UTC (3 hours ago)
(HTM) web link (www.cnx-software.com)
(TXT) w3m dump (www.cnx-software.com)
| qalmakka wrote:
| Wow, I always though this was unfeasible due to how limited the
| ESP32 MMU is.
| sudobash1 wrote:
| The MMU is not really a requirement in this situation, a
| processor with a real MMU is emulated in software[1] on the
| ESP32 (this is the virtual machine referred to in the article
| and comments)
|
| 1: https://github.com/juiceRv/JuiceVm
| qalmakka wrote:
| Uh, so that's the trick, very neat.
| amelius wrote:
| Does this processor support privilege levels? And threads?
| vbezhenar wrote:
| What does it mean for processor to support threads? I thought
| that threads are OS-level abstraction.
| anaisbetts wrote:
| You need a programmable timer interrupt to be able to preempt
| running code, but in general you're right
| amelius wrote:
| Well, the processor needs to be able to do the context-
| switching (switch all registers, i.e. the visible state of
| the cpu, with those of another thread). You can obviously do
| this in software (emulate it) but that would be too slow for
| most practical purposes. Hence the question.
| monocasa wrote:
| Most context switching code happens in software. It's only
| occasionally that cores have hardware task switch support.
| amelius wrote:
| Interestingly, Intel has hardware context switching
| support, but apparently Linux and Windows don't use it.
|
| https://en.wikipedia.org/wiki/Context_switch#Hardware_vs.
| _so...
| monocasa wrote:
| Yeah, that was it's own system that had a lot of
| mismatches with how different OSes wanted to conceive of
| task switching.
|
| Where Intel ended up was the xsave/xrestor family of
| instructions to save and restore processor state
| according to a bit flag argument of high level functional
| units. And that's really only because of how complex all
| of the extensions to x86 have been over the years; a
| fresh arch is probably just better off manually writing
| everything with normal loads and stores until right
| around the iret equivalent. Dumps between the register
| file and memory show up on perf traces anyway so it's
| generally a very optimized path in the CPU for general
| uses anyway.
| monocasa wrote:
| No to privilege levels, yes to threads.
|
| But to answer your question more completely, it's running a
| RISC-V emulator which is then running the Linux kernel.
| dheera wrote:
| That's cool. Even CircuitPython doesn't support threads.
| nousermane wrote:
| MicroPython (CircuitPython's upstream) does:
| MicroPython v1.16; ESP32 module with ESP32 Type
| "help()" for more information. >>> import
| _thread >>> _thread.start_new_thread <function>
| muti wrote:
| Video of the boot was linked in comments
| https://www.youtube.com/watch?v=w9UlZIYZtwI
|
| Note the description: video is sped up 30x
| GekkePrutser wrote:
| Weird. It shouldn't be _that_ slow. I 've run Linux on a 486
| 16mhz which was definitely slower than an esp32 and it was
| performing just fine.
| [deleted]
| faisalhackshah wrote:
| Sort of equivalent to this:
| https://hackaday.com/2012/03/28/building-the-worst-linux-pc-...
| anthk wrote:
| Not even close. 8MB of RAM with a 32bit processor will run
| Linux perfecly well on minimal builds.
|
| A 230MHZ 32bit CPU it's far more powerful than a 8bit processor
| emulating a 32bit one.
|
| You could use cli apps and even X perfecly well with 16MB and
| 80MHZ in 1996.
| faisalhackshah wrote:
| Similar in the sense that both approaches essentially run
| Linux in a VM, virtualizing the typical hardware required
| such as the MMU. In essence, it's the esp32 version isn't
| much different, just faster as the core is faster.
|
| Would be cool to get no-MMU Linux running on it. I've seen
| that run on STM32F7's natively..
| danachow wrote:
| Linux doesn't target the xtensa nor does it have a proper mmu
| so this is emulating a risc-v. It is still very much in the
| novelty "hack" realm.
| anthk wrote:
| Ah, then that's different, because I've run Linux under an
| Armv5 device with 32+16mb of RAM with zram just fine.
| ASalazarMX wrote:
| > it takes two hours to boot up to a bash prompt, and four more
| to load up Ubuntu and login. If you want a Megahertz rating,
| good luck; the effective clock speed is about 6.5 kilohertz.
| While the worst Linux PC ever won't win any races, its simple
| construction puts it within the reach of even the klutziest of
| hardware builders; the entire device is just a microcontroller,
| RAM, SD card, a few resistors, and some wire.
|
| I don't know why, but this little kludge greatly pleases my
| sense of aesthetics.
| IgorPartola wrote:
| I remember when I first learned of MySQL's triggers I
| immediately thought that it might be fun to use them to
| implement a microcontroller or even a full computer emulator.
| A table with registers, a table for RAM, etc. If it was x86
| or ARM or some such then I could compile Linux on it and then
| run MySQL inside of that!
| jhgb wrote:
| Should have run Oberon, though.
| bradleypowers wrote:
| Sort of equivalent to this (installing Linux on a dead badger):
| http://strangehorizons.com/non-fiction/articles/installing-l...
| Taniwha wrote:
| Note: this is for the new RISC-V ESP32 (not the older xtensa
| based one)
| seba_dos1 wrote:
| Nope.
|
| > (...) one developer apparently managed to boot Linux 5.0.0 on
| a board with an ESP32 dual-core Xtensa processor (...)
|
| > The shortened boot log above shown the bootloader output with
| ESP32-D0WD dual-core Xtensa processor eventually booting Linux
| 5.0.0.
|
| It's booting to a RISC-V virtual machine which then boots
| Linux, which may have confused you.
| Taniwha wrote:
| OK - that makes sense - it was OpenSBI which is a RISCV only
| thing that confused me
| agucova wrote:
| The article says that it's not, and according to the reddit
| post, it seems to be using a JuiceVM port to ESP-IDF, allowing
| it to run on the Xtensa version.
| jsight wrote:
| Loading was super slow for me. Archived copy:
| https://archive.is/kx3o9
| xfer wrote:
| The repo link: https://github.com/juiceRv/JuiceVm
|
| It seems to be booting a riscv vm, which is capable of running
| linux. The hardware capabilities of ESP32 is not very
| important(except being fast enough).
| nousermane wrote:
| "Fast" is relative here. According to the youtube link OP
| posted in CNX comments, it takes 6 minutes to boot to shell.
| Still, better than two hours @dmitrygr's ARMv5-on-AVR emulator
| took.
| dmitrygr wrote:
| yeah, 240MHz 32-bit cpu does help compared to the 20-mhz
| 8-bitter :)
|
| Although, Xtensa can execute out of RAM, so here a JIT could
| be used for a larger speedup. Maybe i'll build a RiscV-to-
| xtensa jit some day when i'm bored
| xutopia wrote:
| Pardon my question. Why is this significant?
| codezero wrote:
| This is pretty amazing. I remember the first computer I installed
| Linux 1.x on had 12 megs of ram in around 1992 or 1993? The
| smallest system I built/ran it on even back then was probably a
| 386 with 4MB of ram and it was so slow. Kind of amazing that
| after so much work, even torn down to the bare minimum it can run
| the modern kernel on such minimal hardware!
|
| Edit: probably worth noting that esp32 cores are an order of
| magnitude higher frequency than those 90s computers.
| kevin_thibedeau wrote:
| You could run a serviceable Linux console on 4MB RAM back then.
| X11 was also doable though it would be swapping heavily with
| less than 8MB.
|
| Nowadays it would be more practical to add ESP32 support to
| uClinux and skip the unnecessary performance hit of the VM.
| Teknoman117 wrote:
| Is uCLinux even still alive? Last time I checked the main
| website was gone.
| anthk wrote:
| Back in the day you had plenty of SVGAlib games, PDF readers
| and even video players. You didn't need X at all,
| mp3blaster/mpg123 worked crazy fast on a Pentium and with
| Screen you had the perfect multitasking environment for the
| TTY.
| [deleted]
| ttctciyf wrote:
| > swapping heavily with less than 8MB.
|
| No kidding! My intro to X was seeing it load bare-bones on my
| enthusiast friend's 2M (could have been 4) 386.
|
| I think he brought xfontsel up or something and you could see
| the scanlines being drawn one at a time :)
|
| A couple of years later, I was running fvwm2 and a very
| serviceable desktop at work in 8M though. (AFAIR, anyhow.)
| anthk wrote:
| FVWM2 it's even lighter and faster than TWM. Test it if you
| don't believe me.
|
| With the wireframe mode, it's even faster on moving and
| resizing.
| bch wrote:
| Moving and resizing wireframe boxes seems like to me like
| an ergonomic and technical win - it's a bit baffling to
| me why it's not the default everywhere, no matter what
| the compute/gfx capabilities.
| anthk wrote:
| Yeah, it's crazy how CWM it's crazy fast on my AMD Turion
| 2 but windows lag a bit upon moving/resizing them.
|
| Implementing a wireframe mode on CWM should be dumb easy
| and a lot of older machines would profit from that.
| coupdejarnac wrote:
| 12 megs in 92? Fancy.
| codezero wrote:
| Haha, tell me about it. I think the 4MB upgrade cost around
| $300 or $400 at the time? Similar to my first 1GB hard disk
| which came a few years later that cost $500.
|
| I was a little spoiled since my dad worked for a telco, so we
| tended to have decently modern computers and modems for that
| reason. I was REALLY fancy when I got 128k ISDN in 1996.
| macjohnmcc wrote:
| The computer I was using at work in 92 had a whopping 16mb!
| It was amazing. It might have been a 386 20MHz (before the
| cache was added to the systems so was very slow compared to a
| 25Mhz that came out soon afterwards).
| xchip wrote:
| Note: It uses a virtual machine
___________________________________________________________________
(page generated 2021-07-19 23:00 UTC)