1 Create a bootable SPI flash

V0.0.4

1.1 Histroy

  • 2014-10-15, rayoslee, release V0.0.4
    • add “new SPI flash ID” in driver.
  • 2014-04-07, rayoslee, release V0.0.3
  • 2014-04-02, rayoslee, release V0.0.2
  • 2014-03-07, rayoslee, release V0.0.1

1.2 FAQ

  1. How to create a bootable SPI flash of the S605-32 demo kit?
    • Build your_spi_conprog.bin(kernel image) by “./build spi” in your BSP.
    • Open your S605-32 demo kit to create your_spi_jffs2.summary
    • Open your debug tool(using putty or others)
    • In console screen Copy all files under /mnt/skyeye/ to /mnt/nand1-2
      (Ignore warning messages “cp: cannot create symlink…:Operation not permitted”)
      # cp -af /mnt/skyeye/* /mnt/nand1-2/

      Copy all files under /mnt/nand1-1/etc/ to /mnt/nand1-2
      #cp -af /mnt/nand1-1/etc /mnt/nand1-2

      Copy all files under /mnt/nand1-1/wifi/ to /mnt/nand1-2
      #cp -af /mnt/nand1-1/etc /mnt/nand1-2

      Rename skyeye_romfs.bin under /mnt/nand1-1 to other name
      #mv /mnt/nand1-1/skyeye_romfs.bin /mnt/nand1-1/_skyeye_romfs.bin

      flush system buffer
      #sync

    • Take out micro SD card from S605-32 demo kit and copy all files under nand1-2 to NB/PC(ubuntu) skyeye_jffs2 for making jffs2.summary

      Delete some files to reduce jffs2 file size

      rm -f skyeye_jffs2/bin/arm-none-linux-gnueabi-Smpl_MP3Encoder
      rm -f skyeye_jffs2/bin/curl*
      rm -rf skyeye_jffs2/lib/pkgconfig
      rm -f skyeye_jffs2/lib/skyeye/plugin_multicaster.so
      rm -f skyeye_jffs2/lib/skyeye/plugin_alarm.so
      rm -f skyeye_jffs2/lib/skyeye/plugin_avi_reader
      .so
      rm -f skyeye_jffs2/lib/skyeye/plugin_ulaw_encoder.so
      rm -f skyeye_jffs2/htdocs/SkyEye/cambozola.*
      rm -f skyeye_jffs2/htdocs/SkyEye/MulticastViewer*.jar
      rm -f skyeye_jffs2/htdocs/SkyEye/menu_multicast.html

      Make some symlink for utility in skyeye_jffs2/lib

      ln -s ld-uClibc-0.9.29.so ld-linux.so.3
      ln -s ld-uClibc-0.9.29.so ld-uClibc.so.0
      ln -s libuClibc-0.9.29.so libc.so.0
      ln -s libdl-0.9.29.so libdl.so.0
      ln -s libgcc_s.so.1 libgcc_s.so
      ln -s libminiupnpc.so.8 libminiupnpc.so
      ln -s libm.so.0 libm.so
      ln -s libm-0.9.29.so libm.so.0
      ln -s libpthread.so.0 libpthread.so
      ln -s libpthread-0.9.29.so libpthread.so.0
      ln -s libz.so.1.2.3 libz.so
      ln -s libz.so.1.2.3 libz.so.1

      Change this folder to 775
      # chmod -R a+x skyeye_jffs2/

    • Create a JFFS2 file system image

      # mkfs.jffs2 -r skyeye_jffs2 -o skyeye.jffs2 -e 0x10000 --pad=0x0500000
      # sumtool -l -e 0x10000 -p -i skyeye.jffs2 -o skyeye.jffs2.summary

    • sudo apt-get install mtd-utils for installing mkfs.jffs2 if you have no this tool.

  2. How to preload image to SPI flash using TurboWriter in Window NB/PC?
    • Plug in power from mini USB port to S605-32 demo kit
    • Connect S605-32 demo kit USB 2.0 port to PC/NB and Open debug tool( using putty or others)
    • Set S605-32 demo kit to Recovery mode (connect the jump) and press Reset button (PC/NB will show USB disks)
    • Run go.bat
    • Wait around 7s, you will see “Mass Storage Connected !”
    • Select SPI in “Please choose type:”
    0) PreSpiLoader_0930.bin 
        [Image NO] 0 
        [Image Type] System Image 
        [Image execute address 0x]  
        [Image start bank 0x] 
    
    1) SpiLoader_gzip.bin 
        [Image NO] 1 
        [Image Type] Data 
        [Image execute address 0x] 900000  
        [Image start bank 0x] 1 
    
    2)  your_spi_conprog.bin
        [Image NO] 2 
        [Image Type] Execute 
        [Image execute address 0x] 0 
        [Image start bank 0x] 4 
    
    3) your_spi_jffs2.summary 
        [Image NO] 3 
        [Image Type] Data 
        [Image execute address 0x] f00000 
        [Image start bank 0x] 30
  3. How to change your SPI flash ID when you mount your SPI flash in TurboWriter?
    • Go into TurboWriterX and execute go.bat
    • Reset S605-32 demo kit and switch to SPI in “Please choose type”
    • See debug message(using putty or others) to check your SPI flash ID.
    • For exampe: My SPI ID is 012018. You can compose it in SPIFLASH ID.ini for yours1.1.
SPI FLASH ID

Figure 1.1: SPI FLASH ID

  1. How to create a bootable SPI flash of the S605-32 demo kit (Almost the same 1.)?
    • Build your_spi_conprog.bin(kernel image) by “./build spi” in your BSP.
    • Prepare your_spi_jffs2 source
    mkdir skyeye_fw
    sudo mount -t romfs skyeye_romfs.bin skyeye_fw (skyeye_romfs.bin is from SD1-1)
    mkdir skyeye_jffs2
    cp -af skyeye_fw/* skyeye_jffs2/
    rm -rf skyeye_jffs2/etc
    cp -af SD1-1/etc skyeye_jffs2/
    cp -af SD1-1/wifi skyeye_jffs2/
    chmod -R a+x skyeye_jffs2/
    • Delete some files to reduce jffs2 file size
    rm -f   skyeye_jffs2/bin/arm-none-linux-gnueabi-Smpl_MP3Encoder
    rm -f   skyeye_jffs2/bin/curl*
    rm -rf  skyeye_jffs2/lib/pkgconfig
    rm -f   skyeye_jffs2/lib/skyeye/plugin_multicaster.so
    rm -f   skyeye_jffs2/lib/skyeye/plugin_alarm*.so
    rm -f   skyeye_jffs2/lib/skyeye/plugin_avi_reader*.so
    rm -f   skyeye_jffs2/lib/skyeye/plugin_ulaw_encoder.so
    rm -f   skyeye_jffs2/htdocs/SkyEye/cambozola.*
    rm -f   skyeye_jffs2/htdocs/SkyEye/MulticastViewer*.jar
    rm -f   skyeye_jffs2/htdocs/SkyEye/menu_multicast.html
    • Create a JFFS2 file system image

    # mkfs.jffs2 -r skyeye_jffs2 -o skyeye.jffs2 -e 0x10000 --pad=0x0500000
    # sumtool -l -e 0x10000 -p -i skyeye.jffs2 -o skyeye.jffs2.summary

  2. How to add new SPI flash ID in driver?
    • About spi flash driver, we have the table to add new spi flash ID under HW SPEC. You can have a look linux/drivers/mtd/devices/m25p80.c and find the table m25p_ids.
    • Next, you need find new flash ID whether exists or not, INFO(0xef4018, 0, 64 * 1024, 256, 0). If not, please check out item 3 to get ID.