Magic Lantern Brings Linux To Canon EOS Cameras

On April 1st the Magic Lantern team announced a proof of concept that lets you run Linux on a Canon EOS camera. Because of the date of the post we’ve poured over this one and are confident it’s no joke. The development has huge potential.

The hack was facilitated by a recent discovery that the LCD screen on the camera can be accessed from the bootloader. In case you don’t recognize the name, Magic Lantern is an Open Source project that adds features to these high-end cameras by utilizing the bootloader with binary files on the SD card. It’s long been a way of hacking more features in but has always been complicated by the fact that you must figure out how to play nicely with the existing firmware. Commanding the LCD was the last part of the hardware that had previously not been driven directly from Magic Lantern.

Now that the Linux kernel is in the picture, ground-up features can be built without dealing with the stock firmware in any way (and without overwriting it). We’re excited to see where this one goes. Currently it’s just a proof that you can boot Linux, it’s not actually functional yet. Here’s your chance to polish those kernel porting skills you’ve been holding in reserve.

43 thoughts on “Magic Lantern Brings Linux To Canon EOS Cameras

      1. Actually, other Andrew has it right. The verb ‘pore’ means to meditate, and in modern vernacular is used almost exclusively in the phrase ‘pore over’. I would hope that’s what they meant, as there aren’t a great many things they could pour over this hack while maintaining its function.

    1. Lantern runs within the host firmware and adds code where it can fit it. Linux would replace the stock firmware image, meaning you could build a camera from scratch.

          1. Most of the features work by poking the original firmware to do stuff it wasn’t programmed to do. Replacing the stock firmware with Linux, one loses literally everything, including how to read the imaging sensor and turn it into a JPEG.

            The entire camera has to be re-implemented, including the secret algorithms the manufacturer has spent years and millions of dollars to develop so the camera would turn out better pictures than their competitors.

          2. I see your point dax, but I find camera manufacturers are rather flawed in a lot of what they do, and the firmware is certainly a part of it. Not only are they often not including features you cannot figure why not, but also there might be things that are rather task-specific for a user, like astro-photogrpaphy or some such specialized area. Or you might even have thought up something they did not, some experimental thing. And sme of that requires a hands-on approach.

            But yeah, you would need to know a lot of details of the hardware to write a complete firmware obviously, and you have to wonder if that will ever work that well.

          3. I think of the camera firmware as multiple levels. There is the low level device driver that deals with the devices, the signal processing code that has the Canon’s special sauce for noise reduction, calibration etc and then the upper level of application code that does the stuff etc.

            Surely you can replace the os with linux, figure out and write your own the low level device drivers by reverse engineering the existing code. There is no denying that the application code is lacking and that was why there are these alternate run time firmware patches. Those code calls the existing framework and low level signal processing onto of the existing environment to customize the firmware to the liking.

            While it might be a pain, but there is no need to throw away everything and start from scratch just because you want linux. A RTOS might be better suited than linux as you aren’t really benefiting from all the linux drivers. What you don’t get is the fancy algorithms (some secret sauce and no doubt some with patents) that make their camera special to their competitors. You might even do worse than the cheapest Chinese cameras that have little R&D efforts put into them other than whatever SDK that the sensors or SoC comes with.

            Wake me up when you can a comparable picture quality with the stock firmware… I am still waiting for the CHDK port on DIGIC IV+ and I am not holding my breath for that which easily a few orders of magnitudes easier than this.

          4. In my experience, running a custom firmware like CHDK alongside with the stock firmware just makes the whole camera slow and runs the battery down really quickly.

          5. @tekkieneet But if you just stick to the RAW format then you avoid a lot of ‘secret sauce’ won’t you? And if you for instance have photoshop you can use their secret sauce to make your JPEG if so required.

            Come to think of it, one thing that would be nice in a camera is the ability to make PNG or TIF files instead of JPEG. Or other more modern formats with higher bit depth and lossless capabilities. And maybe the new BPG format which is based an HEVC and seems rather promising https://en.wikipedia.org/wiki/Better_Portable_Graphics

        1. Having Linux directly on the camera could make it possible to encrypt pictures directly on the SD card, a feature wanted for a long time by war reporters or others travelling in places where searches are common place.

          1. Or require a password to delete images from an encrypted drive. Would prevent police from “accidentally” deleting incriminating images/videos from confiscated recording devices.

          2. Steganography (hiding incriminating pictures inside the file of an existing picture) might be the better choice, so that when the cards are read they simply show a set of innocuous images. Usually less resolution for the hidden image, but a B & W image that gets out is better than a perfect one that doesn’t. This can be broken/deleted etc., of course as discussed in other comments, but you’re depending on cursory examination, likely using the camera itself or a quick look on a laptop somewhere.

        2. Id like time-lapse features that a lot of cameras lack.
          Hell, my Nintendo 3DS has a timelapse mode, its staggering that cameras worth a few hundred dont as standard.

          Oh, also despite the fact my camera has wifi, it cant either act as a host or client for a pc/route for some insane reason.
          Just some bespoke thing for connecting to mobile phones.
          I still need to get the SD card in and out to copy stuff, its nuts.

        3. It could be anything really.
          Take for example astrophotography – camera that can control itself to take multiple exposures, control the mount, perform autoguiding and plate solve on the fly…. This would be so awesome and would allow to get rid of that cobweb of cables imaging setups are usually entangled in.

      1. ¨Lantern runs within the host firmware and adds code where it can fit it. Linux would replace the stock firmware image, meaning you could build a camera from scratch.¨ correct, not only could you, but you would *have* to build from scratch, and this is just the first small step down that possible route. This is a long way from a fully working linux port, but it looks like very rich territory to explore.

        1. Well Dax, I should have mentioned steganography also. Having full control of the hardware could make the SD card and camera appear totally stock to a totalitarian regimes law enforcement with hundreds of non encrypted pictures of cats and flowers, that have been solved.
          The point is that they can rip your card out of your camera at any checkpoint without you being had, as the encryption / steganography happens after each picture is snapped. Usually all that has to be done on a laptop in post processing, which raises further suspicion, especially if you have encryption- and Steganography software installed.

          This is really great news for human rights activists and journalists, also it will be possible for them to mail such obfuscated pictures as cats and flowers through ordinary government controlled ISP’s without having to carry any incriminating software or hardware. It’s also a specialized knowledge field to use such programmes the right way which few have, especially in conflict zones. Having an equivalent to Tails, for cameras as a distro, could make the path to a more tolerable world shorter.

          1. It’s not really that great, because how the system works is, you put a certain folder with certain files on the SD card and then move the write-protect tab to trigger a firmware upgrade, which makes the system boot up your custom firmware. That’s how Canon made it.

            If they pull the card and slot it in a laptop, they can see immediately that something fishy is going on and simply confiscate your card without ever bothering to check what’s actually in it. That’s what any rationally thinking oppressive regime would do.

            When you try to accost them for destroying your property, they’d simply go “What SD card? Never seen any, you must be mistaken.” All these clever tricks are defeated by a simple “Oh you got a camera, let me see… *smash*”

    2. Not so much unlocking but implementation, there are some extremely useful features like auto bracketing that continues until a specified percentage of the image is within the dynamic range of at least one exposure; motion detection and fine tuning the bitrate of recorded video (as well as being able to overcome the recording length limit).

    3. There is always at least one person that ask some variation of this question: “Why are you doing this, what is the benefit, why not do XYZ instead!?”

      The answer to all these and more is “Fuck you, that’s why.”, everyone is just too polite to say it.

  1. The very interesting thing about this seems to me is that you could build your own camera. I have been waiting
    for someone to figure out how to stitch more than one sensor together to make something that would fit a medium
    format camera and not cost an arm and a leg. I’m pretty much an amateur hacker and I thank you for being so
    gutsy with the Canon cameras.

  2. I’m with Dax on this one. There are some things that are more work than they are worth. However, that IS the spirit of hacking. Perhaps the community will eventually put in enough effort to rival the stock firmware, but not my cup of tea.

    It seems that many of the hacks people would want (and mentioned above) could be accomplished with the stock firmware. And if the flash is not big enough, look into upgrading that.

    Of course, being able to run ‘apps’ to add features would be pretty cool.

  3. To all the naysayers… seriously!?!
    It’s just a start – yes there are going to be tons of challenges Canon has solved ages ago. But you might as well say that about Linux vs Windows (don’t get started on the technicalities and origins please). Or Wii homebrew vs the original software.
    Or even the entire Arduino movement that has thousands of people now coding where before it was all barebones compilers.
    The point of this is that it can be done and that opens up a lot of doors that until now were closed.

    A modified GUI for training purposes. A custom built firmware for cameras mounted at police stations for ID photos – that does the processing on camera and allows a one-click process for the technician. Custom interfacing with radio modules for the adventurous. And a bunch of other things.

  4. I could never afford cameras like these. My main interest is the data that the camera sensor provides, and very precise control over the hardware inside the “camera” that give you latitude to vary how and when the images are captured.

    I really do not want yet another hacked together operating environment, haphazard community of developers. It is not Linux and some other OS, including the manufacturer(s) and knockoffs. It is that same endless starting from scratch again that wears me out.

    Perhaps someone is making nice controllable photodetector arrays (image sensors) that are completely controllable. AND not gouging every one for doing so. If there is one pathology on the web that hurts society more than anything else, is people thinking they should make lots of money from some hack they got working.

    The camera makers have closed systems because of greed and copying. This hurts their customers, including the few with quantitative and technical interests. I am tired, so it is hard to keep all the thousands of interactions in mind.

    There are certainly open source solutions for cameras. But if you can hack an old existing device, that saves you a bit of cash, then eats you alive with the hack time it takes, how much is your time worth? Are you saving a few hundred dollars, but spending fifty or a hundred hours trying to make the hack fit your needs?

    In the international community, the value of a persons time can be estimated with the GDP per capita. There are many discussions, but it is a place to begin to try to understand. In the United States now, the GDP/capita is about $53,000 per year, or roughly $25 per hour. So if you save $200 from hacking something, you should probably not be spending more than 200/25 = 8 hours trying to get it to work.

    HackaDay is making some progress, as is technical society as a whole. But it waste vast amounts of precious human capability with false economy.

    What is it you all want from a computer controlled camera? Putting linux on the camera impiles that someone wants to use software to get something from the camera sensor, or to do something. They apparently, perhaps not even sure why they are doing it, are trying to use the full capabilities of the hardware that already exists to better purpose. But what those purposes?

    I would dearly love to be able to control the exact timing of when frames are taken, down to the picosecond. And I would like to know exactly when each pixel data record is gathered. I would like handy, better than best in class calibration tools to make what I have better than anything on the planet.

    Recently I played again with the knock off sports cameras. They are getting better, but they are black boxes that are not controllable, do not have standard functions for control and reporting of internal conditions. Allow no access to the analog data from components in the “box”. This is no different than an EOS or other big black box.

    If Hackaday or some other community were thinking broadly, they would look carefully at what their customers/members are doing and want to do, and trace back their connections and possibilties. If HackaDay were a virtual corporation, or a coherent community, and you were trying to optimize the time and skills of that community, what would YOU do? Me, I try to help the people around me, to backtrack and change the practices of their suppliers, try to help clarify markets and opportunities.

    I don’t do anything for money any more, I am retired, getting worn out, and preparing to die. It bothers me that people join a community (not just this one) and are left to their own devices. If this, HackaDay, or even just the people here who use and want to use optical sensors were a city, where are the services and benefits that would ease the whole?

    I have had to learn to visual the whole universe and everything in it. And every person on the planet, past and present, and all their interations, activities and impacts. It is not complete, but when I look at “cameras” on the internet, there is much social waste. Just counting the time of people like yourselves, it is horendous how hard it is to get little things to work.

    Now, working haphazardly as individuals does, over centuries, move society forward, and back, and this way and that. From my perspective what should have been done in years is taking decades, because people are not organized and serious about things they spend massive amounts of time on.

    I will stop here, and only hint that an open source “internet camera” community professionally managed, in a larger community looking at all sensors, and still larger communities cleaning up data handling, and other groups focusing on the real problems of society — is needed.

    Richard Collins, The Internet Foundation

Leave a Reply to Tore LundCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.