1 2 Previous Next 17 Replies Latest reply on Jun 11, 2016 6:54 PM by MartinOrtuno

    Flashall.sh and pre-built xFSTK


      I thought I'd open a discussion on flashing Edison using the flashall script available as  part of the downloadable image for Edison.


      I'm not talking about the OTA upgrade, I'm just talking about the flashall method, which can be used to recover a bricked device, to change partition sizes, or, indeed, to put on different Operating Systems such as ubilinux (Debian).


      What I've found so far:


      1. flashall.sh does NOT work on a mac, the script explicitly exludes macs, and it says it only works on linux and windows.
      2. I have yet to get it working on a Windows machine, when running flashall.bat, there are USB devices coming up and down, and the script just continues regardless without actually doing any flashing, I suspect my driver setup on windows is not right.
      3. The only platform I've had success with was Linux. Specifically 32-bit versions of Ubuntu. No luck on 64-bit, and I haven't tried any other OS. Anyway, Ubuntu 14.04 32-bit works great.


      I'm not saying this is the only way, but it's the way that works for me.


      However, there are a few gocha's in getting Linux working. If you want to do a recovery option with the flashall script, it uses a tool called xfdtk-downloader-solo, which is part of the xFSTK package from sourceforge.net. It's not installable via apt-get, etc, you usually need to build for source.

      The fllashall script also uses dfu-util, but that's easily obtainable, as you can use apt-get to install it.


      So, for those folks that don't have a Linux machine lying around, I thought I might make it a little easier by suggesting the creation of USB live-boot of a suitable Ubuntu, and attach a pre-compiled version of xFSTK to this post so people don't have to compile xFSTK from source. The rest can be done on the live-boot it'self.




      • Get your hands on an 8Mb USB stick. Try and get a fast one. DOS format it.
      • Download Ubuntu 14.04 32-bit ISO.
      • Download http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
      • Using the universal-usb-installer, create a live-boot USB key. Make sure you give it plenty of persistent storage in step 4 of the dialog, as you'll need that to extract your flash images. I'd recommend 4 Gigs.
      • Once that's done, you can copy on the xfst-downloader-xxx.deb (attached) and the Edison image file (downloads section) onto the same live-boot USB stick.
      • Now boot a machine using the USB stick. When booting, select the "Try Ubuntu" option. The persistent storage we selected when creating the bootable USB key will allow us to make changes that persist across boots, so we don't have to re-do everything every time we boot.
      • Once you're into Ubuntu, have a look at the /proc/partitions, and have a look for what might be your USB key. Mount the relevant partition to /mnt and you should then see your xfstk .deb and your Edison image file. Copy them into your home folder, and unmount /mnt.
      • Now you can install the xFSTK tools - "dpkg -i xfstk-downloader-_0.0.0_all.deb"
      • The apt-sources need to be tweaked to give us access to the dfu-util package, it's not present in the live-boot image, so open up /etc/apt/sources.list and add the line:
      • then do a sudo apt-get update
      • followed by a sudo apt-get install dfu-util
      • Now you have all the tools you need, next to do the flash.
      • tar xvfz EdisonIMageFile (whatever it's called, might be Yocto, might be ubilinux)
      • cd toFlash
      • Run "sudo flashall.sh -b"
      • Connect on the Edison via USB, and the flash process should proceed.
      • You can have a second USB cable connected into the console USB connector on the Edison and monitor the progress from that size. You can sudo apt-get install minicom, then minicom-D /dev/ttyUSB0 -b 115200 to get at the console.



      All going well, you should now be able to completely flash (including recovery option) your Edison.


      So the next time you want to flash, you can simply boot up the USB key, get the new image, and flash from there. And Keep that USB key safe for the next time


      The .deb file attached is a pre-build package of the unmodified source of version 1.7.2 from sourceforge here. If it's not OK to attach this, let me know and I'll remove it, but think that it's OK.

      It's for Ubuntu 14.04 32-bit.

        • 1. Re: Flashall.sh and pre-built xFSTK

          Hi Dave,


          Just sharing my experience:

          I'm using Ubuntu 14.04.1 LTS 64-bit to flash the default yocto build and also your ubilinux. I don't have problem running it. BTW, I don't even need xfstk when using flashall.sh from download page for yocto build (I need to install xfstk, when running flashall.sh from your ubilinux).  I got my Edison the day before, so only play one day with it. It come with old firmware so I update the firmware (try both copying to folder, then "reboot ota", and also the flashall.sh script, both work fine). Then I decided I need debian than plain yocto, so tried ubilinux. flashall.sh barked than I need xfstk, that when I start installing xfstk on my 64-bit ubuntu box. Is there any chance your flashall.sh is older than the one on download page? The download page doesn't said anything about version (request), but the file I use was "edison-image-ww36-14.zip"

          (I'm back to the plain yocto build right now, since ubilinux not work with bluetooth yet)


          Could you elaborate your problem, when you said no luck with 64-bit ubuntu?

          • 2. Re: Flashall.sh and pre-built xFSTK

            If you stay with the Yocto image, you probably never need to run the recovery option with flashall. Because there's a different partitioning scheme with ubilinux, the '-b' option is required, which repartitions the emmc and calls flash-ifwi in the script. This flash-ifwi function uses either phoneflashtool or xfstk-dldr-solo, depending on what's installed. So when I'm running the -b option, I don't have phoneflashtool (and couldn't find it on the net), so I'm left with the option of installing xfstk (i.e. building from source)

            xFSTK  only seems to build on 32-bit ubuntu, as it explicitly requires linking  against a 32-bit version of libusb.a. xFSTK refuses to build on a 64-bit OS for me.

            So as long as you stick with Yocto, you don't need to use -b or -recovery option, therefore you don't need xfstk.

            The flashall.sh I'm using in the ubilinux build is the same one as from the Yocto 36.14 image. 

            • 3. Re: Flashall.sh and pre-built xFSTK

              Okay, that explain the xfstk requisity (I'm too lazy  to look inside flashall.sh script).

              As for linking and running 32-bit library on 64-bit OS,  I think you can try to use 32-bit library version on 64-bit OS (apt-get install libusb-dev:i386, perhaps).

              But I checked libusb.a on my 64-bit ubuntu box, only 64-bit version installed, and I don't have trouble compiling xfstk on that box.


              Intel getting started documentation about flashing on Windows, currently doesn't mention flashall.bat (only Linux and Mac version). So I am under impression it still experimental.

              Funny if the script explicitly excludes OSX, as the documentation mention it as alternative flashing method. (someone as lazy as I am is maintaining the site?)

              • 4. Re: Flashall.sh and pre-built xFSTK

                Just for info (at the time I post this):

                Release Note doc is for W37.

                While software download is W36.

                I think then next software release (W37) is on horizon.

                It might not completely related, but new feature on release note said dfu-util for windows for ex.

                • 5. Re: Flashall.sh and pre-built xFSTK

                  Hello Dave,

                  installed the ubiLinux today using your ready xfstk deb file, works fine - thanks again!

                  I installed it on two Edisons. One needs weirdly about 60 mins to flash the rootfs, the other needs the advertised 5 mins.


                  It writes the access times for each file on the rootfs - not good for mmc. I changed it in fstab (noatime).

                  "rsyslog" and "logrotate" - also two candidates i don't need on such a handy system all of the time.

                  And for my needs i additionally  mounted /tmp, /var/tmp and /var/log as tmpfs.


                  But now i made a terrible mistake in the "post-up" procedure of the network interface.

                  Edison hangs there during bootup and i can't login anymore (no wlan and no serial access). Seems like i have to install all again.


                  I'm very glad to get all the advantages of Debian for the Edison with this - really nice.


                  Regards, mmi

                  • 6. Re: Flashall.sh and pre-built xFSTK

                    flashall in general should work on mac. However, the "flashall --recovery" probably not

                    • 7. Re: Flashall.sh and pre-built xFSTK

                      BTW, I don't even need xfstk when using flashall.sh from download page for yocto build

                      xfstk is required if you need to run "flashall --recovery"

                      • 8. Re: Flashall.sh and pre-built xFSTK

                        Hi mmi,


                        I think you are experiencing the same issue experienced by faceplant on the ubilinux topic: Re: ubilinux (Debian) now available from Emutex Labs


                        Please have a look at the second page of the ubilinux thread where I explain how to fix the continuous reboot issue when your WiFi is not in range (or the configuration is not correct).

                        • 9. Re: Flashall.sh and pre-built xFSTK

                          Hi Daniele,

                          thanks but it was another issue. I prefer setting the time immediately during bootup. So i set a command for "up-post" in network interfaces. I had a mistake there and this command never returned. So i never got a login prompt - bootup hangs (forever). Solved it by flashing the rootfs again and i had a backup to rsync all my personal changes back.

                          • 10. Re: Flashall.sh and pre-built xFSTK

                            Check out this post for information on how to tweak the flashall.sh script so you don't need xFSTK in order to flash images that have different partition sizes than the default Yocto image.



                            • 11. Re: Flashall.sh and pre-built xFSTK


                                 Could you paste in your version of /etc/fstab here? I'd like to include the  noatime change and tmpfs changes in the next build.


                              • 12. Re: Flashall.sh and pre-built xFSTK

                                Hi David, here it is:


                                /dev/root   /   auto   defaults,noatime,discard    1 1
                                proc             /proc            proc   defaults          0  0
                                devpts           /dev/pts         devpts mode=0620,gid=5   0  0
                                debugfs          /sys/kernel/debugdebugfsauto              0  0
                                tmpfs            /run             tmpfs  mode=0755,nodev,nosuid,strictatime 0  0
                                tmpfs            /tmp             tmpfs  defaults,noatime  0  0
                                tmpfs            /var/log         tmpfs  defaults,noatime  0  0
                                tmpfs            /var/tmp         tmpfs  defaults,noatime  0  0
                                tmpfs            /var/volatile    tmpfs  defaults,noatime  0  0


                                /dev/mmcblk0p10 /home   autodefaults,noatime 1   1


                                Does "discard" on the rootfs make sense ?

                                • 13. Re: Flashall.sh and pre-built xFSTK

                                  I had to do a sudo


                                  still not sure why i can't upload a sketch


                                  Had my yun up in running in less then 10 minutes

                                  • 14. Re: Flashall.sh and pre-built xFSTK

                                    Thanks Dave.  Hopefully I won't brick it, but very nice to have in case.  Thanks again.

                                    1 2 Previous Next