1 2 Previous Next 20 Replies Latest reply on Sep 8, 2015 9:14 PM by chewcheik

    Recovering form a bad linux image

    ril3y

      Hello All,

       

      I have been experimenting with building some native packages in the default Edison env and I royally screwed up my libc bins.  So I am in need of just restoring my linux image that is in my "Edison drive" already.

       

      However,  its not as easy as I thought.  I have the Arduino board and I have read about the FW and RM buttons but I am not sure I understand what they do.  Here is the deal.  I have no way to boot linux far enough to ask to reboot ota.  What is the best way to init a reflash of my linux image?  I can abort the autoboot and drop to that prompt but that is about it.  Is there any instuctions on restoring the linux image from this state.  I am sure its possible but I would rather see some real docs or an reply from someone that has worked the project vs. me poking around and really messing it up

       

       

      Thanks,

       

      Below is my issue however unhelpful the output may be.

       

      Riley

       

       

       

       

       

      ******************************

      PSH KERNEL VERSION: b0182727

                      WR: 20104000

      ******************************

       

      SCU IPC: 0x800000d0  0xfffce92c

       

      PSH miaHOB version: TNG.B0.VVBD.0000000c

       

      microkernel built 23:15:13 Apr 24 2014

       

      ******* PSH loader *******

      PCM page cache size = 192 KB

      Cache Constraint = 0 Pages

      Arming IPC driver ..

      Adding page store pool ..

      PagestoreAddr(IMR Start Address) = 0x04899000

      pageStoreSize(IMR Size)          = 0x00080000

       

      *** Ready to receive application ***

       

       

      U-Boot 2014.04 (Sep 08 2014 - 14:09:10)

       

             Watchdog enabled

      DRAM:  980.6 MiB

      MMC:   tangier_sdhci: 0

      In:    serial

      Out:   serial

      Err:   serial

      Hit any key to stop autoboot:  0

      Target:blank

      Partitioning already done...

      Flashing already done...

      GADGET DRIVER: usb_dnl_dfu

      reading vmlinuz

      5124544 bytes read in 127 ms (38.5 MiB/s)

      Valid Boot Flag

      Setup Size = 0x00003c00

      Magic signature found

      Using boot protocol version 2.0c

      Linux kernel version 3.10.17-poky-edison+ (sys_dswci@ncsndgbuild04) #1 SMP PREEMPT Mon Sep 8 14:09:55 CEST 2014

      Building boot_params at 0x00090000

      Loading bzImage at address 00100000 (5109184 bytes)

      Magic signature found

      Kernel command line: "root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 systemd.unit=multi-user.target hardware_id=00 g_multi.iSerialNumber=cf0f861b9892037c16302780c06fbad0"

       

      Starting kernel ...

       

      [    1.636982] pmic_ccsm pmic_ccsm: Error reading battery profile from battid frmwrk

      [    1.645409] pmic_ccsm pmic_ccsm: Battery Over heat exception

      [    1.645496] pmic_ccsm pmic_ccsm: Battery0 temperature inside boundary

      [    1.650009] pmic_ccsm pmic_ccsm: Battery0 temperature inside boundary

      /sbin/init: error while loading shared libraries: libc.so.0: cannot open shared object file: No such file or directory

        • 1. Re: Recovering form a bad linux image
          msg4alex

          Hello,

           

          At the boot options prompt, write run do_ota, that should flash your Edison.

           

          Alexandru

          • 2. Re: Recovering form a bad linux image
            Intel_Alvarado

            Hi,

             

            If you are looking for the docs to flashing the Edison I suggest you to take a look at this guide https://communities.intel.com/docs/DOC-23200 .

             

            Regards

            Sergio

            1 of 1 people found this helpful
            • 3. Re: Recovering form a bad linux image
              ril3y

              So bad news.....

               

               

              boot >

              boot > run do_ota

              reading ota_update.scr

              ** Unable to read file ota_update.scr **

              Saving Environment to MMC...

              Writing to redundant MMC(0)... done

              resetting ...




              So not sure what to do next.  Alavardo... I cannot boot  all the way so there is NO way I can mount a filesystem.  Unless I am mis-understanding you.


              Also is there a way to do something along the lines of "run do_ota" for mounting the MMC so I can copy files to it? 


              • 4. Re: Recovering form a bad linux image
                lrosenman

                if you look at the /usr/bin/configure_edison script there is the magic.

                 

                See also my post re: ota_update.scr.....

                 

                You need to install the uboot-tools for your distro, and get it in to the e

                1 of 1 people found this helpful
                • 5. Re: Recovering form a bad linux image
                  jeff_nxt

                  lrosenman and Intel support folks,

                   

                  Thanks for all the assist you've been providing. I'm reaching out to you guys and the community at large because after a few hours of attempting to recover, I can't seem to get the FWR_RCVR method (using the Arduino breakout board), or any other method to work with regard to recovering from a boot problem (basically I messed up some of my critical libraries and the system won't boot). Quick note: I backup up all of my original libraries to a microsd card before creating this problem. Is there, perhaps, a way to mount the card, and mount the local file system and copy the affected file(s) over??

                   

                  Here's what I'm experiencing:

                   

                  When attempting to use flash.all, the script is waiting for dfu device 8087:0a99. No matter what I do (keyboard combinations, etc) I can't seem to get the Edison board to show up as the desired USB device. Here's my local machine's output from lsusb (both micro USB ports are connected to the computer and the switch is pointing toward the two ports). Btw, this is also the same Ubuntu Linux-based laptop that I originally flashed the Edison board on:

                   

                  Bus 002 Device 003: ID 0a5c:5802 Broadcom Corp. BCM5880 Secure Applications Processor with fingerprint touch sensor

                  Bus 002 Device 032: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC

                  Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

                  Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

                  Bus 001 Device 028: ID 1bcf:2b83 Sunplus Innovation Technology Inc.

                  Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

                  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

                   

                  As you can see, the FTDI device (on ttyUSB0) shows up just fine.

                   

                  Output from "run do_ota":

                   

                  Environment size: 4555/65531 bytes

                  boot > run do_ota_init

                  boot > run do_ota

                  reading ota_update.scr

                  ** Unable to read file ota_update.scr **

                  Saving Environment to MMC...

                  Writing to MMC(0)... done

                  resetting ...

                   

                  Below is the output showing my main problem - where it stops on bootup. I created this issue by working on various lib files, making symlinks, etc. I'm simply trying to recover so I can continue development (and not make the same mistake!!).

                   

                  U-Boot 2014.04 (Sep 08 2014 - 14:09:10)

                  Watchdog enabled

                  DRAM:  980.6 MiB

                  MMC:  tangier_sdhci: 0

                  In:    serial

                  Out:  serial

                  Err:  serial

                  Hit any key to stop autoboot:  0

                  Target:blank

                  Partitioning already done...

                  Flashing already done...

                  GADGET DRIVER: usb_dnl_dfu

                  reading vmlinuz

                  5124544 bytes read in 127 ms (38.5 MiB/s)

                  Valid Boot Flag

                  Setup Size = 0x00003c00

                  Magic signature found

                  Using boot protocol version 2.0c

                  Linux kernel version 3.10.17-poky-edison+ (sys_dswci@ncsndgbuild04) #1 SMP PREEMPT Mon Sep 8 14:09:55 CEST 2014

                  Building boot_params at 0x00090000

                  Loading bzImage at address 00100000 (5109184 bytes)

                  Magic signature found

                  Kernel command line: "root=PARTUUID=012b3303-34ac-284d-99b4-34e03a2335f4 rootfstype=ext4 console=ttyMFD2 earlyprintk=ttyMFD2,keep loglevel=4 systemd.unit=multi-user.target hardware_id=00 g_multi.iSerialNumber=74e2f7ca908e45d049d1263a11197038"

                   

                  Starting kernel ...

                   

                  [    1.635219] pmic_ccsm pmic_ccsm: Error reading battery profile from battid frmwrk

                  [    1.644121] pmic_ccsm pmic_ccsm: Battery Over heat exception

                  [    1.644207] pmic_ccsm pmic_ccsm: Battery0 temperature inside boundary

                  /sbin/init: error while loading shared libraries: libkmod.so.2: cannot open shared object file: No such file or directory

                   

                  The above line in bold/red is my problem-child...

                   

                  Thanks for *any* assist on this matter. I've pretty much exhausted my resources (primarily the Intel site and numerous permutations of button presses, viwing log files, etc). and I've finally resolved to throw up the white flag!

                   

                  Jeff D.

                   

                  p.s. I researched many posts regarding Edison recovery, but I couldn't find anything that would help me out. Granted, I'm a sw engineer and roboticist, so some things regarding u-boot or ota_update.scr or the configure_edison script might not jump right out at me. If I've glossed over something just point it out and I'll be happy to do the leg work.

                  • 6. Re: Recovering form a bad linux image
                    lrosenman

                    the missing ota_update.scr is probably the root of the issue.

                     

                    do you have mkimage in ${SDK_HOME}/u-boot/tools?

                     

                    If not, install your distro's u-boot tools, and then:

                     

                    cd ${SDK_HOME}

                    mkdir -p u-boot/tools

                    cd u-boot/tools

                    ln -s /usr/bin/mkimage mkimage

                     

                    then re-run the postbuild.sh, and recopy the files to the eMMC.

                    • 7. Re: Recovering form a bad linux image
                      jeff_nxt

                      lrosenman,

                       

                      Thanks for the quick response! I didn't originally use the SDK, I simply flashed the Yocto image from this site to the Edison's file system. After booting up cleanly, I proceeded to move things to a mounted MicroSD card. I moved and created a symlink to one (or possibly more) of the libs that I wasn't supposed to move (due to file system mounting order and dependencies). The Edison worked incredibly well until I FUBAR'd my setup by moving those files. It all started because I ended up with  0 bytes left on the root file system and I was attempting to free up some space.

                       

                      I'm wondering if I can interrupt the boot process and perform maintenance from the "boot >" prompt??

                       

                      If the only way that I can recover is to download the SDK and try to reflash, then I'll work through it tonight - but what appears to be the issue at hand is the inability for the Edison to allow me to mount it from my local machine. So, if I did download the SDK and built a new boot image, I still wouldn't have a means of copying it across to the Edison - or would I? I might be missing something basic, but that's my current understanding of the order of precedence in trying to recover.

                       

                      Now here's something that I thought would yield positive results:

                      - I stopped the autoboot process and issued the "run do_flash" command which resulted in:

                       

                      boot > run do_flash

                      Saving Environment to MMC...

                      Writing to redundant MMC(0)... done

                      GADGET DRIVER: usb_dnl_dfu

                       

                      When I ran lsusb, I saw the correct device appear: Bus 002 Device 086: ID 8087:0a99 Intel Corp. When I ran the flashall.sh script, it quickly responded with the following:

                       

                      Using U-Boot target: edison-blank

                      Now waiting for dfu device 8087:0a99

                      Please plug and reboot the board

                      Flashing IFWI

                      Flashing U-Boot

                      Flashing U-Boot Environment

                      Flashing U-Boot Environment Backup

                      Flashing boot partition (kernel)

                      Flashing rootfs, (it can take up to 5 minutes... Please be patient)

                      Rebooting

                      U-boot & Kernel System Flash Success...

                      Your board needs to reboot twice to complete the flashing procedure, please do not unplug it for 2 minutes.

                       

                      Prior to getting the board into this state, the flashall script would time-out waiting for the correct USB device to be detected. Now that it sees the correct device, it quickly steps through the script without errors but it also doesn't flash anything to the board.

                       

                      Jeff D.

                      • 8. Re: Recovering form a bad linux image
                        ril3y

                        lrosenman,

                         

                        I have been trying to piece your info together to come up with exactly what you describing! LOL.

                         

                        This is what I have come up with:

                         

                        I downloaded the edison-sdk (linux64 weekly as is my os / arch)

                        extract and run the sh file that extracts the "SDK" to:

                        /opt/poky-edison/1.6/

                         

                        I then did what you said above:

                        cd /opt/poky-edison/1.6

                         

                        then run

                        mkdir -p u-boot/tools

                        cd u-boot/tools

                        ln -s /usr/bin/mkimage mkimage  *I had to  apt-get install u-boot-tools  to get mkimage installed *

                         

                        Here is where I am at a loss. 

                         

                        ril3y@ubuntu:~/Downloads$ ./edison-src/device-software/utils/flash/flashall.sh

                        Using U-Boot target: edison-blank

                        Now waiting for dfu device 8087:0a99

                        Please plug and reboot the board

                        Flashing IFWI

                        Flashing U-Boot

                        Flashing U-Boot Environment

                        Flashing U-Boot Environment Backup

                        Flashing boot partition (kernel)

                        Flashing rootfs, (it can take up to 5 minutes... Please be patient)

                        Rebooting

                        U-boot & Kernel System Flash Success...

                        Your board needs to reboot twice to complete the flashing procedure, please do not unplug it for 2 minutes.



                        Notes:

                        I just used the prebuild image here:

                         

                        edison-image/u-boot-envs/edison-blank.bin  and copied it into

                         

                        cp edison-image/u-boot-envs/edison-blank.bin /home/ril3y/Downloads/edison-src/device-software/utils/flash/u-boot-envs/


                        the above 'flashing" completes in seconds and then I wait the 2 minutes and then reboot and still is the same thing.



                        Any thoughts?



                        • 9. Re: Recovering form a bad linux image
                          lrosenman

                          Hrm.  Did you look at the stuff on the configure_edison script on how the mount/loopback works?

                           

                          Also, I'd d/l the yocto build stuff, and be prepared to re-flash....

                          • 10. Re: Recovering form a bad linux image
                            lrosenman

                            I may be used the wrong terminology, you need the image building stuff...

                             

                            Intel® Download Center

                             

                            Build Intel Edison Yocto Image From Scratch

                            • 11. Re: Recovering form a bad linux image
                              ril3y

                              Can  you provide more information?  How does the configure_edison script play into this ?  I thought this was ran after your edison was booted?  Or perhaps I am missing things?

                               

                              Also I did download the build stuff and am prepared to flash   In fact that is what I thought I was doing?  Perhaps you could provide a bit more information as to what that means?

                               

                              Thanks for the help man.

                               

                              Riley

                              • 12. Re: Recovering form a bad linux image
                                lrosenman

                                are you in a state to get the sdcard (eMMC) from Edison mounted somewhere?

                                 

                                If so, read the BSP user guide, and/or get the latest image pre-built....

                                 

                                Intel: I know there is a page with all the images, but for the life of me, I can't get back to it.....

                                 

                                Can we get a sticky with that link for both Galileo and Edison?

                                • 13. Re: Recovering form a bad linux image
                                  jeff_nxt

                                  (updated @ 17:48 Pacific - added a missed step)

                                   

                                  FIXED! These are the three main steps to fix a non-booting system that needs to be re-flashed (you will lose lose any files previously placed on the file system):

                                   

                                  1. Stop the autoboot process on the Edison and get the the "boot >" prompt
                                  2. Once you're at the "boot >" prompt, type "run do_flash". You should see the following output:
                                    • Saving Environment to MMC...

                                    • Writing to redundant MMC(0)... done

                                    • GADGET DRIVER: usb_dnl_dfu

                                  3. Once you see the "GADGET DRIVER: usb_dnl_dfu" message, the Edison board is in the correct state to accept flashing again. In the directory where the Yocto image files were uncompressed, run the following command (with su privileges!!): sudo ./flashall.sh

                                   

                                  Using U-Boot target: edison-blank
                                  Now waiting for dfu device 8087:0a99
                                  Please plug and reboot the board
                                  Flashing IFWI
                                  Download [=========================] 100%      4194304 bytes
                                  Download [=========================] 100%      4194304 bytes
                                  Flashing U-Boot
                                  Download [=========================] 100%      245760 bytes
                                  Flashing U-Boot Environment
                                  Download [=========================] 100%        65536 bytes
                                  Flashing U-Boot Environment Backup
                                  Download [=========================] 100%        65536 bytes
                                  Flashing boot partition (kernel)
                                  Download [=========================] 100%      5799936 bytes
                                  Flashing rootfs, (it can take up to 5 minutes... Please be patient)
                                  Download [=========================] 100%    536870912 bytes
                                  Rebooting
                                  U-boot & Kernel System Flash Success...
                                  Your board needs to reboot twice to complete the flashing procedure, please do not unplug it for 2 minutes.

                                   

                                  What you'll see in your serial connection terminal (which should be connected the way you initially connected to your Edison device):

                                   

                                  [  OK  ] Started Getty on tty1.
                                           Starting Serial Getty on ttyMFD2...
                                  [  OK  ] Started Serial Getty on ttyMFD2.
                                  [  OK  ] Reached target Login Prompts.
                                  [  OK  ] Started Network Name Resolution.
                                  [  OK  ] Started Login Service.
                                  Poky (Yocto Project Reference Distro) 1.6 edison ttyMFD2
                                  edison login: root
                                  [  686.080697] systemd-fsck[231]: /dev/mmcblk0p10: clean, 12/152608 files, 26867/610299 blocks
                                  root@edison:~# df -h
                                  Filesystem                Size      Used Available Use% Mounted on
                                  /dev/root               463.9M    303.3M    124.8M  71% /
                                  devtmpfs                480.2M         0    480.2M   0% /dev
                                  tmpfs                   480.5M         0    480.5M   0% /dev/shm
                                  tmpfs                   480.5M    480.0K    480.1M   0% /run
                                  tmpfs                   480.5M         0    480.5M   0% /sys/fs/cgroup
                                  tmpfs                   480.5M    480.0K    480.1M   0% /etc/machine-id
                                  [  693.572894] systemd-fsck[246]: dosfsck 2.11, 12 Mar 2005, FAT32, LFN
                                  [  693.575483] systemd-fsck[246]: /dev/mmcblk0p7: 5 files, 2591/2819 clusters
                                  systemd-1                 5.5M      5.1M    456.0K  92% /boot
                                  tmpfs                   480.5M      4.0K    480.5M   0% /tmp
                                  systemd-1                 2.2G      3.5M      2.2G   0% /home
                                  tmpfs                   480.5M         0    480.5M   0% /var/volatile
                                  /dev/mmcblk0p5         1003.0K     21.0K    911.0K   2% /factory
                                  /dev/mmcblk0p10           2.2G      3.5M      2.2G   0% /home
                                  /dev/mmcblk0p7            5.5M      5.1M    456.0K  92% /boot

                                   

                                  Done, and back to square one!

                                   

                                  Jeff D.

                                  • 14. Re: Recovering form a bad linux image
                                    ril3y

                                    Yup this works.  Thanks Jeff!

                                    For future people with this issue.  I did a lot to get this working but I am pretty sure you need the dfu-util installed before ./flashall is going to work.  I would love to do a fresh install and say what to download / install but I havent the effort after fighting this for the better part of a week off and on.

                                     

                                    Riley

                                    1 2 Previous Next