1 2 3 Previous Next 36 Replies Latest reply on May 25, 2015 8:59 PM by lth

    Debian on Edison


      Hello everyone,


      Has anyone tried to create a Debian image for the Edison yet? I understand that this should be easier to create than the Galileo one due to the fact that the Edison is Atom-based. But this is not something I've done before, so I thought I'd ask first before I start messing with it.




        • 1. Re: Debian on Edison

          I've been wondering the same thing.  It would be nice to have the option of a more standard Debian distribution.

          • 2. Re: Debian on Edison

            Hi Razvan,


            it is possible, I did it already.

            There are two things you have to consider: the kernel itself and the root file system are two different things. When you are talking about having the Debian as Linux distribution running on the Edison you have to fulfil two tasks:

            1. 1) You have to build your own kernel and kernel modules with the Yocto SDK. Using the SDK is easier since it already patches the 3.10.17 kernel that it fits to the Edison. If you don’t want to use the Yocto SDK you have at least to extract the patch file in the Yocto structure and patch the plain 3.10.17 vanilla kernel from kernel.org.
            2. 2) You have to bootstrap the Debian root file system. Bootstrapping is a mechanism which creates a minimal root file system in a local folder of your host machine. For the creation of that root file system in a folder on your host machine you can chose the Debian edition and what architecture (i686/x86_64) you want to use. The process downloads and installs all necessary files to that local folder. If this is done you can chroot into that folder and do the whole setup of the serial port (needed to have the login and debug output on serial port not on a X system) and install with apt different other needed packages. In that state you can customize your root file system like you need it. After that step you have to copy the firmware and kernel modules which you have built in the previous step to the according /lib/firmware and /lib/modules/<your kernel version> folder.


            Having all that in place you can create the ext4 disk image file out of this folder and flash it like any other official release you get from the download page. You have to flash also the kernel itself that the kernel modules and kernel are matching each other. If you want to have the wireless features etc. also enabled you have to build the drivers against your newly build kernel and copy modules + firmware also to the Edison.


            ATTENTION: this procedure can get your Edison in a state where it is really hard to recover it, so if you are not really familiar with the steps described above, consider not to do it!

            • 3. Re: Debian on Edison

              That sounds great! Would you mind making the image available with some installation instructions? Is it possible to revert to the default Edison firmware after this? The default flashing procedure asks you to upload the firmware files onto the mass storage that Edison creates when connected via USB, I'm assuming that no longer works when running Debian.


              Also, some Android distributions allow you to run Debian under chroot (using the Android kernel), I wonder if this would work on the Edison as well. This would not require a reflash, it would run side by side with the original distribution. Has anyone tried this?

              • 4. Re: Debian on Edison

                Hi Razvan,


                let me check on your first point and see what I can do there, I'll keep this thread updated

                The second point is not as easy as it seems like. Especially Android kernels have a lot of hooks and modifications to fit to the use-cases Android is intended for. Even the official x86 port of Android has a lot of custom adoptions. And if you then plan to run it on the Android you have to adopt the kernel patches made for the 3.10.17 vanilla kernel. Of course it is possible to use the x86 port for Android with a custom kernel, but this is also a little bit tricky.

                But what you are describing with the chroot command under Android is also possible under the pre-installed Yocto distribution. It is possible in the same way as under Android to change the root-fs with the chroot command and use the already running kernel with the Debian root-fs. Just as described above, bootstrap a Debian installation onto an USB stick, plug it into the Edison Arduino board and chroot to that system. Maybe you have to re-mount some special folders, but basically you are happy to go with the Debian system. Let me see what I can and if I find some time to write a short howto for that.

                • 5. Re: Debian on Edison

                  I would certainly be among the many appreciative here if you were able to make your Debian image and instructions available.  I've completed so much development of a particular application on the Raspberry Pi under Debian Wheezy, and having the ability to transition all of that work to the Edison form factor would be extremely helpful.


                  • 6. Re: Debian on Edison

                    Here are the instructions for getting at least the chroot method working. The setup was prepared with a SD card and a Fedora 19 host machine. Before you can start make sure that you have your debootstrap application already installed on the host machine, otherwise install it with yum install deboostrap. After you have it in place, continue with the following steps:

                    1. Create the mount point for the SD card: sudo mkdir /mnt/sdcard
                    2. Mount the SD card (in this example the SD card is recognized by the system as mmcblk1): sudo mount /dev/mmcblk0p1 /mnt/sdcard
                    3. Start bootstrapping the Debian system with: sudo debootstrap --arch i386 wheezy /mnt/sdcard/ http://http.debian.net/debian/
                      This will install a minimal base system for an 32 bit system and the newest Debian release called Wheezy
                    4. The process of downloading the packages and installing the base system can take quite a few minutes. It depends mainly on the SD card class and your internet connection speed. When the process has finished you'll see this message: I: Base system installed successfully.
                    5. After the base installation you can already chroot to the new file system and start installing additional apps like python or development tools: sudo chroot /mnt/sdcard /bin/bash
                    6. When you are done, leave the chroot environment with exit and unmount the SD card: sudo umount /mnt/sdcard
                    7. Start your Edison and log in to the system, plug in the SD card. The SD card should be get auto mounted to /media/sdcard.
                    8. An important step is to remount the special directories from your actual root file system to the new one you will use later on, therefore execute the following commands:
                      1. mount proc /media/sdcard/proc -t proc
                      2. mount sys /media/sdcard/sys/ -t sysfs
                      3. mount dev /media/sdcard/dev/ -t devtmpfs
                    9. These are just the most important ones, when you are typing mount in the standard root file system you will get a list of all mount points and special file systems used in the system, you can than decide which you want to remount to your new file system, too.
                    10. Now you can change into your new Debian root file system with: chroot /media/sdcard /bin/bash
                    • 7. Re: Debian on Edison

                      After an afternoon of playing with Lucas' solution, I was able to get it working without requiring an SD card on Edison. I followed his steps 1-6, but then copied the wheezy file structure to a /wheezy directory I created on Edison. Then, in analogy to what he did:


                      mount proc /wheezy/proc -t proc

                      mount sys /wheezy/sys/ -t sysfs

                      mount dev /wheezy/dev/ -t devtmpfs

                      chroot /wheezy /bin/bash


                      Then I did the "unthinkable" and installed Apache2 with PHP5, and gphoto2, from by simply using 'apt-get install' in the usual fashion. I tested the Apache2 server from another machine on my LAN and it works flawlessly in executing PHP5 scripts on (wireless) Edison.  I haven't tested gphoto2 yet, since I'm lacking a suitable adapter to plug in my camera to the Edison's USB port.


                      Now if I can just figure out how to have Edison automatically shift to wheezy upon boot up.



                      • 8. Re: Debian on Edison

                        You know what would be a cool addition to all this? Using kexec (see YANUB: yet another (nearly) useless blog: Creating and booting an ia32 debian system from an amd64 one for instance) to load a new kernel and then use the Debian root you've created. You would then be able to create your own kernel without messing with the Intel default (and possibly bricking your Edison).

                        • 9. Re: Debian on Edison



                          I created a script to install a Debian chroot directly on the Edison without the need to prepare anything on a PC.


                          The /home partition is usually mounted with nodev and cdebootstrap does not like that so one needs to remount the /home partition:


                          mount /home/ -o dev,remount


                          Running the attached bootstrap-debian-edison.sh shell script on the Edision creates a wheezy Debian chroot in /home/root/debian


                          Afterwards /home can be remounted with nodev again, the chroot will use a bind mount to the original /dev anyway:


                          mount /home/ -o nodev,remount


                          The setup-chroot-mounts.sh shell script sets up the mounts for /sys, /proc and /dev in the chroot.


                          To switch to the chroot use:


                           chroot /home/root/debian/ /bin/bash


                          -- Hans

                          1 of 1 people found this helpful
                          • 10. Re: Debian on Edison

                            Wow, this worked great for me! Intel should really do this by default, it's pretty cool and far more powerful than the builtin Yocto-based distribution.

                            • 11. Re: Debian on Edison

                              BTW, you're also going to have to set up the mount point for /dev/pts (separate from /dev) - with "mount --bind /dev/pts $DEBIAN_CHROOT/dev/pts ".

                              • 12. Re: Debian on Edison

                                A few apt-gets later I have a web browser, a terminal and Bitcoin Core running on the Edison side by side, in an X session (using VNC to view it). It's really amazing that something the size of a postage stamp can run all this perfectly.


                                • 13. Re: Debian on Edison

                                  Yes! On wheezy I just installed Apache2 and PHP5, and made/installed the latest gphoto2 (2.5.5) from source after installing various dependencies with apt-get. It's sweet having a Debian system.

                                  • 14. Re: Debian on Edison

                                    One problem I'm stuck on is a "broken" sudo after I chroot into Debian.  I need to execute a command with root privileges from a perl script that is executed by Apache2.  Apache2 executes the script as user 'www-data'.  In a normal Debian environment, I can use sudo within the perl script, e.g. system("sudo command ..."); and make it work.  With this chroot setup on Edison, the Apache2 error log shows the error 'sudo: effective uid is not 0, is sudo installed setuid root?'.  I Googled this error and attempted to apply remedies I found there, but to no avail.  Any ideas? 



                                    1 2 3 Previous Next