How to Run Linux on an ESP32
ฝัง
- เผยแพร่เมื่อ 13 พ.ค. 2024
- Can you run Linux on an ESP32? Until recently, you could just answer "no!" But, in fact, you can run Linux on a specific variant of the ESP32-S3 MCU! Based on this, Clem saw an opportunity to build his own Linux-powered SBC in the form factor of the Raspberry Pi 4 Compute Module.
Along the way, he creates a CM4-style template, a simple command line flashing tool to make the process easier, and two iterations of his module (called Sudosom) that could be used whenever a real Raspberry Pi might be overkill, but a simple MCU just won't cut it for your project.
Discuss the episode, find all resources for the project, and ask Clem questions on the element14 Community! bit.ly/46eU5Nq
element14 Community discussion on using Linux on the ESP32-S3: bit.ly/3rNONtc
Engage with the element14 presents team on the element14 Community - suggest builds, find project files, and see behind the scenes video: bit.ly/3tmdewv
Visit the element14 Community for more great activities and free hardware: bit.ly/3q6YMpu
Tech Spotlights: bit.ly/3qPrDhM
RoadTest and Reviews: bit.ly/3pV5Bux
Project14: bit.ly/31wbnJY
#0:00 Welcome to element14 presents
#0:22 Overview
#2:31 The PCB in KiCAD
#6:15 Assembly
#8:10 Linux
#10:25 Another Iteration??
#15:12 Let's Demo!
#17:09 Give Your Feedback
#esp32 #esp32project #linux #raspberrypi #pcbdesign #pcbdesigning - วิทยาศาสตร์และเทคโนโลยี
So are there any projects you would like to see built running linux on such a cheap tiny mcu? maybe we could make a linux version of the basic badge?
If using an esp32 you can probably add Nicer display to your 328 badge along with wifi and stuff
@@matthewmcphail7703probably..but these lcds have a special place in my heart.
How about a network print server for 3D printing?
Maybe a lightweight alternative to Octoprint?
A light weight NAS, time server, VPN, Ad blocker
Pi hole!
If you do another board design I'd suggest adding an SDCard slot to host the /home and /usr dirs to install software, and possibly switch from UART to SPI for communication with the RP2040 as it will be much faster to send graphic commands across (UART has some overhead, and no clock pin, so can desync at high speeds - you could hit 40mhz or so over SPI).
Good suggestions!
@@MAYERMAKES awesome project.
Literally came here to say the same thing but with emmc instead!
I usually choose microcontrollers specifically when I don't want an OS getting in my way... but this is giving me some interesting ideas. Nice!
its kinda like a forbidden fruit..isn´t it.
Too true. My fav is still the esp32, amazing features, fully arduino-ized. If I have to use an OS, it has to be non-write; Fixing OS type problems.
U can always use built in os.. freertos
This fills a definite niche. The primary advantage of this project is now you have the robust Linux networking stack. Previously, your options would have been FreeRTOS+TCP, LWIP, uIP and similar. They all work, but they’re all very much limited and very compromised.
What problem with OS for mcu? It is not necessary to use OS like Linux. Simple OS (FreeRTOS, etc) for mcu very useful too.
And maybe you don't know, but when you create new project for ESP32 in some IDE, your project will contain OS like FreeRTOS, and no matter will you use it`s fuctions or not.
This is absolutely amazing! It looks like a ton of fun. Fantastic work 🙌🏻
thanks!
Congrats mate! Great job!
This is very cool, and I think it opens up a lot of exciting possibilities! I'd love to see a follow-up video showing how to do stuff like interfacing with the GPIO pins, communicating with other devices via I2C, and doing other traditional microcontroller stuff. I have a couple of questions as a starting point:
1. Would it be possible to run a webserver like lighttpd of Apache on the board?
2. Would applications that require critical timing (like driving WS2812B LEDs) fail miserably?
Webservers and driving serisl leds work very good on esp32 without linux.
Ots a very good choice for such applications.
This is so awesome!
Thx😂
wow great work! Thanks for the share. I would of also liked to see the linux do some cool things with the rest of the module and carrier board but oh well maybe on the next video.
Exciting!
indeed! imagine all the crazy stuff we could build now!
mind-blowing work bro! amazing!
thanks
Very cool, I would like to see it used in a project.
Me too😂
Absolute wonderful! I just can dream on installing an OS on my complex projects! Thanks a lot!
you are welcome.
For Esp32 you may use not only Linux. Simple OS like FreeRTOS very useful too.
this would be awesome to remote update a linux edge application, not to mention all the logging etc for light embedded applications thanks for sharing!!
thats agreat idea for an application!
Having Node-Red running on the ESP32 would be super cool!
Dude this is amazing
Thx😂
You have an awesome project but one thing I would love to see added to that project is the ability to have a SD card added. Yeah, there are a few ways to do that but having it built into the board design would be awesome.
Also, would love to see if you could get the Linux system built for the ESP32 running on the Lilygo T-Deck.
On Linux build u can enable spi supporting on other pins when u compile binary. And enable mountable. Now, your esp32 can see any spi devices(if driver build-in on compilation), and sdcard too!
But… Speed of running Linux wants to be better(although it’s just a microcontroller)
Sorry for my English. I’m not native speaker
Aw man this would be sick as a webserver with two or three stepper drivers. I'm building a miniature observatory for a small telescope and am using an ESP32 to control it all.
Man..i love this! I would literally try to use this in my IOT projects, where I want to minimize power usage. Microcontroller running some RTOS with some library for Internet protocols is just to complicated to implement, in this case, a MCU that runs Linux would be extremely easier to implement, and power usage would still be in a extremely low ranges. Nice. I like open minded people with ideas like this
thanks, lets hope the projects takes of!
Great discovery thank you!
you are welcome
if USB starts working then it would mean a microcontroller can finally print on an inkjet or a laser printer instead of those thermal printers.
😂among other things, but drivers also need to be ported
Since WiFi is working, I think you "only" need to port cups and the printer driver.
My god, of all the things you want to play with right out of the gate the hell of inkjet printers is what you pick? masochist.
Lol it'd literally be easier to put a pen in a 3d printer and spit gcode at it 😂
@@zyeborm that's because you can't imagine how many requests I get from clients to integrate printers in the controllers I make for industrial purposes. Then I am forced to use a linux SBC to do just that.
@@nafisahmed6247that is actually a common request😮
Great video, very much fun it looks like 😊😊
Thank you 🤗
Wonderful work!
Thx😂
Very cool, and well explained!
I was wondering - as you are able to connect to the ESP through SSH - if you can up/download files via SFTP commands?
take a look at the demo at the end of the video. I connect vias SSH and download stuff from an ftp server via wget so sftp is not far fetched.
@@MAYERMAKES I saw. But if sftp is also supported that would eliminate the step of having to upload first the files to an external server, allowing a direct transfer through SSH connection.
that should be doable when you compile the kernel from scratch with Rudis script probably @@jerrymagnin4248
For future revisions of your board, I advise looking into proper routing techniques for 4 layers boards. The routing you showed for the first revision wasn't really good, especially for a board with a RF module. Basically choose a good stackup, and think about returns paths for your signals.
there is for sure a lot to improve about routing, main consideration for now was to get it manufactured in time.
@@MAYERMAKES makes sense.
On this topic, Robert Feranec published good interviews of Eric Bogatin and Rick Hartley on TH-cam that are a good introduction on the subject.
You could port openwrt to run on an ESP32. This would be awesome.
Someone could 😂 I'm not smart enough for that
@@MAYERMAKESif you can share me thr kernel config i might be able able to make xtensa as new build target for openwrt that wil run on initramfs, i would say instead someone could port nl80211 implementation for xtensa instead 😊maybe we can collaborate?
Thank you for nice video. Do you have any idea about SD card on this board? I am sure that it will open much more options how it can be used
so far this is in the very early stages so att the moment all htat is working is what you see in the video + some utilities and mircopython.
What about a WiFi micro repeater, with pi-hole of possible?
THANKS YOUR THANK YOU THANK YOU FOR YOUR GREAT PRESENTATION + MOST OF ALL
THE GREAT INSPIRATION !!!
NOCHMAL IMMER WEITER !!!
Terrific job 👍
thanks!
Really impressive. These Software wizards are the types who can get alot of performance out of little hardware.
Little hardware... Esp32 in times more powerful than some processors (80386, etc) in old computers.
Very cool project!
thanks
I just got some ESP32-S3 for doing web based wifi serial console for 3d printer usb port. Like MrDIY did with ESP8266, but without soldering to chips, but using the printers usb-serial port through the natíve usb port of ESP32-S3..
nice project!
Loved this video 😍😍.. I was looking how boot esp32 with Linux.. Thanks
Thx😂
Is there a gcc compiler for this linux esp32?
this is absolutely awesome!
I can see it as a local MQTT broker. Does it also handle ESP-NOW? (If not, I can just use a second ESP32 as bridge I guess)
Sure you can flash anything on this that is esp32s3 comoat8ble.
I recently checked out what's in my new IKEA smart home controller and they also run Linux on a tiny STM32.
must be an stm32mp1 , they recently popped up on various embedded computing modules.
Nice video. The error you show for compiling means the spaces in you path to the directory are a problem. Rename the directory with spaces in its name. Also, if you have ssh you can copy files with scp.
Hey, nice video!
What would be the drawbacks of using Linux on ESP32? Are we missing time critical things
The S3 varient is a pretty capable microcontroller. IIRC it has dual cores as well. Not to say it'll be running Plasma or Gnome but if you wanted to run simple daemons and that may need to be more than a couple hard-coded things, I think he said this in the beginning, you really couldn't beat something like this. Not that it would be realtime unlesss the load was considerably managed.
Getting the lighthttp web server running on this would be amazing.
Curl, nginx and php, and c++ dev environment 😊
Can we add SD card support via spi, to expand the file system using overlay file system? It is possible in openwrt on TP link archer c5 router to use usb mass storage as overlay file system.
its in the plans, certainly doable, just a lot of work
Regards to GCC crashing assuming you are using a Ryzen with a lot of cores. If your make -j flags is the same output as nproc. You could be running into a OOM issue or race conditions. I recommend trying with j flag $(nproc) divided by two . this should minimize SMT use and help with RAM. If that doesn't work try a way more conservative -j flag number. And last case try with make -j 1 .
Indeed its a ryzen 3950x, thanks for the tipps
It would be nice to see it merged it with the monolinux project.
interesting, need to google that
I don't know if thats even possible but I would love to see nodejs run on it! 😍
Subscribed to see more..
just thaught of this one: instead of uploading stuff to a webserver and then using wget, since the OS does ssh, you can use scp (or winscp if you are on windows) to move files to it directly.
yes scp is also an option, i wanted to show wegt to drive the point home that the internet connection works-
I guess one would need a abi using compiler? Because the default one will not compile correct elf’s i would guess.
Wow! I hope we can have a linux distribution to this. Wjere we can install apps via package manager.
That would be the ideal outcome
I never think about reporpuse the I/O Board of CM4, I think Is a nice idea, I think pseudo gpu rp2040 can be a nice adition but needs a ton of code to come true
Yes.. that project will haunt me for a while
ohhh, no. the esp32 s3 can now run php. and bash script. and perl. well, if they're compiled for the funky esspressif core architecture. what have you done?
Just amazing! 😮 Great work! 👏🏻 I‘ll have some free time, I would consider to flash Linux on my ESPs too.
Would love to see a second part of this video with working 2040 and HDMI and SATA❤
😂lets hope i get this working
@@MAYERMAKES SATA and HDMI is kinda overkill for a slow chip like that ESP32. Instead I would add a small display directly on the PCB to get something more unique than just another ESP. Maybe a MicroSD slot would be enough, as already suggested by other viewers. I am dreaming of a Pi-CAM-Plug on ESP.
For real, I would buy such a thing if it is not too expensive.
@@wurstelei1356 you can already get images from a camera and stream it over wifi and it would probably work better without running Linux on it.
@@conorstewart2214 Sure thing, but I meant to detect certain colors or pattern without the need to stream it somewhere. Also the cam would just be an additional option like on the Pi.
This Video was about Pi-Compatible form factors so a cam slot, Micro SD, USB and some GPIOs came to my mind.
Anyway lets hope for some nice updates about this.
Would use it for mav link and create an auto pilot I've got loads in mind
High, very great, may be it's possible to add SD-Card and boot from SD-Card ?
possibly as storage, but boot happens from internal rom at this point
Can't you use a microSD card over SPI on Linux?
Well what can you do with it? With 8mb psram your options are very limited. The only viable options are networking products like router, access point, repeater etc based on linux kernel.
Well micropython already works, precompiled code csn be run. So usual automation /control tasks and network related stuff loke webservers come to mind. 😂
@@MAYERMAKES Another idea is to port sqlite server. Best to my knowledge sqlite does not work on freertos. It might be the worlds smallest sql server.
@@ergindemir7366sqlite is a file based database system. there is no such thing like a "sqlite server".
Interesting project 🥂
thx
Wow this is amazing
can you run on this device node js and express???
if someone ports ist possibly
I hope to see this fleshed out more and used in interesting ways.
I prefer a OS for increased functionality, debugging and memory management. I hope to see this keep moving forward with help from the greater community!
😂i do so to! Heeeeelp
Then... use OS that is already built in esp32? It's named freertos - memory menagment, tasks, cores and much more..
Using Linux will only make it slower and harder to debug
If u will google it, always google it as "freertos esp32", because there is also vanilla freertos that was made only for one core
You can already do all the things you described without using Linux on it. You can debug an ESP32S3 over USB and they usually run freeRTOS anyway which lets you make tasks, interrupts, manage memory, etc.
If you think you want an OS on a microcontroller for extra functionality, debugging and memory management then you don’t really know how to use an MCU, you are just trying to use it like a full computer.
Novice question.
Can existing packages like Node-red be ported into the device?
Is there or will there be repositories?
I assume Node-red would need more resources then the ESP can offer.
This is the first video of yours I have watched. Great content.
I think Node-red will not work because of memory being way too small. You could compile it, but installation will probably not fit, plus there will be only about 5MB of free RAM to run anything. There are some other issues, but that would be the main one.
Looking forward to seeing this go further. Does it Python yet?
Micropython is working🎉
Normal Python probably not. On my amd64 machine, just starting interpreter of Python, it eats 11MB of memory. (Empty script that just loops, eats 8MB - less than interpreter, because you load few less modules).This ESP32-S3 has like 5MB of free RAM after booting (2MB out of 8MB is used by kernel, plus a bit by shell and libraries, and maybe a daemon or two).
If you were to run Xorg or Wayland on the ESP32, how much would it choke up trying to run a desktop?
xorg alone requires at minimum four times the memory the esp provides. wayland is just an api description. it is not a software you can actually run.
Can you set up ps vita dock with that?
How could linux fit on that ESP, since its flash size only has a few megabytes.
Or in other words: Is there a SDCard or other Flash module to expand the stock storage of the ESP, or is there a plan/way to do so?
the linux kernel fits on the 8MB flash of the esp32-s3-n8r8, in the vide i use an esp32-s3-N16R8 but ionly the 8Mb are adressed in the firmware.
of course there are plans for sd and usb storage expansions in the future.
Nice video, can we use sqlite for logging?
its all a question of software implementation
Sd card and have it as a very transportable backup / storage up to 1Tb would be probably id use it for ;-)
doing basic file tasks in embedded systems might be a good application
Awesome!
thx
would love to see Home Assitant running on an esp32
I would like to know if it is possible to put an ethernet port in this PCB project. Thanks a lot.
well if you add an ethernet bridge IC to the esp, but for that first the usb host modes should be implemented.
8:25 That does not sound like a software issue ... more likely thermals or power supply...
One thing might be using `make -j` with no arguments (that will attempt to build too many stuff concurrently) or too high of a value for your system (RAM, or core counts)?
all possible, I did not have the time to look more into that .but its a ryzen 3950x and it seems to try to do to much at once. so its worth trying that again with some arguments.
You did this yourself? Or you had a team ? Just curious about peoples workflow.
I did the Hardware shown in the video and the Flash script, the linux port was done by the other people mentioned in the video. btw. prpject is still running!
Don’t the S3 ULP have a dual mode that alow the ULP to act like a state machine ( similar to PIO) ?
not in the same capacity and speed. the PIO is quite unique
Is ReverseSSH working on that?
Would be awesome 😁💯
Ssh works in both directions
So you could use an ESP32-S3 to flash new firmware onto several other ESP32s that are connected via USB? I.e. use it as a fail-proof OTA-updater which itself does not update.
well I dont know if esptool.py is runnable on the eps32s3 but in theory yes, you might get better results with writing a dedicated flasher programm
this actually would do nice as a DMX controller like an old lanbox LCE box
oh indeed
Smart watch!
ooooh
omgomgomg I just realize your channel's name means Silicon 😅
🎉it does🎉
Great. It seems to me that such a board does not need a graphical interface. SSH access is sufficient. Application - easy integration of your devices into your home network and management using such convenient things as python, bash, etc.
Jep, works well without any graphics, but woukd be a cool addon.
I'm not good at listening, so I don't get if we need to use this board and solder an esp on it, or we can use some comercial dev kits found on stores?
just to run linux you could also use an esp32-s3 devkit, but it has to be one with at least 8MB of PSRAM, but the binaries also need to fit that version. the board I made ia basically an application of the concept and putting it already a step forwards towards embedded computing in a popular form factor.
@@MAYERMAKES how do I check the psram of a board/devkit?
The model number should inficate it. N = flash , R= ram . N16R8 = 16mb glash +8mb ram
Brilliant! call it Missing Link.
How about putting this Linux on the TTGO, or FabGL ESP32 board, that has VGA, SD card, PS/2 mouse and keyboard and audio out?
the fabGl board is not compatible, you need an esp32-s3-n8r8 to run linux
This works on an N8R8. Does it also work on the N16R8?
yep actually the one in the video on V2 is a N16R8, but after the flashing it will adress it as if it just had 8MB flash. so there is no difference.
i am interested in running python /QT Software on a soc. but all socs are way to slow in booting. does anyone know an alternative to run python especially as an obd connected dashboard in the car.
you can directly run micropython on esp32, as long as the code does not use any python exclusive libs you cant rewrtite for upython it should do waht you need.
Would be fun to see klipper3d running on it
Run mosquito or node red?
ESP32-CAM board (using ESP32-S chip) has a microSD slot (supporting up to 4GB), FPC connector for camera, flash LED, and 8MB PSRAM. Can it also run Linux?
only if it uses the ESp32-s3.
Would be funny to run the host version of klipper on it with another esp32 runnign the mcu part (esp-inception).
nice idea, but maybe needs a custom Esp32-S3 implementation with more ram and bigger flash!
@@MAYERMAKES _ISSI_ has 32Mb Serial selfrefresh DRAM available ...should suffice ;) - *NO?*
@@reinholdu9909 32 Mb is only 4 MB, which is below the minimum requirements for running Linux, they say it needs at least 8 MB of PSRAM.
Does it run k8s? :0 This would be the ultimate edge device!
Not yet...but maybe that would be possible one day
Wemo mini D1 no?
klipper (3d printer) in esp32
Can all types of ESP32 be installed on Linux? and whether windows can also be installed on esp32
No so far only , s3 with min 8mb of psram.
You can’t just take any OS and put it on, it needs to be ported over. With windows that would require Microsoft to create a version for the ESP32 which just isn’t going to happen.
The performance of an ESP32 doesn’t even compare to modern CPUs, it is just a microcontroller.
This is very cool. I wonder if it would run ROS for robots.
i dont know if ros has any architecture dependent components but with custom flash(for more space/ and ram it might be possible.
Ros in freertos (esp32 os) was ported as micro-ros
So it will be pretty easy to use it
File server and mass storage device
If your PC shuts off during compilation, you do not have a dependency problem... there is either something overheating or not getting enough power in your computer!
Can we install packages to this linux instance?
its just the kernel so if you want to ad software you need to compile it with that included i think.
Personally I would be very happy if I could run free Pascal on it or at least cross compilation.
You know that if you an SSH server on the board you can probably transfer files to the board with either scp or sftp
yeah, but that also requires those packages to be present. scp is, sftp is not.
Hey wait a minute. USB Host isn’t working? Forget it. Thumbs down. Unsubscribe.
Kidding, of course. That is an awesome amount of work both on your part and the software side. I can see this becoming a good option (especially when prototyping) between a SBC and a Microcontroller running a RTOS.
Great Job!
I jope the usb gets soon implemented , whrn that hapoens skies are no longer limits
@@MAYERMAKES With microcontrollers getting faster with more RAM and software engineers getting more clever, it is only a matter of time. Probably a short matter too.
This has potential to become a new RT linux for DIY CNC and robots. It needs a display to take input on output.
hehe, yep take a close gander on the v2 pcb.....
Does it run binary files? Could you run doom on it? :)
you can already run DOOM on ESP32. no linux required. of coiurse you can flash binaries to it.
How can I run tiny core Linux on esp 32?
for now you need to run the exact fork I used in the video, since it uses a different architecture than tiny core was compiled for.