<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>1806</bug_id>
          
          <creation_ts>2011-12-02 15:03:37 +0000</creation_ts>
          <short_desc>Image Writer: provide an image writer tool to simplify the process of getting images to boot media</short_desc>
          <delta_ts>2012-04-09 17:00:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>(P1)  (QA Testing Completed) Done</status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>1.2 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Darren Hart">dvhart</reporter>
          <assigned_to name="Darren Hart">dvhart</assigned_to>
          <cc>dexuan.cui</cc>
    
    <cc>edwin.zhai</cc>
    
    <cc>jiajun.xu</cc>
    
    <cc>josh</cc>
    
    <cc>kishore.k.bodke</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>sgw</cc>
    
    <cc>song.liu</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>17478</commentid>
    <comment_count>0</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2011-12-02 15:03:37 +0000</bug_when>
    <thetext>Standard practice is to use the Linux &quot;dd&quot; command to write images to boot media. This can be error prone and the results of sloppy usage can be disastrous. Locating the device you want to use is a clumsy process, especially on a headless build system. I typically tail dmesg and look for which device was added most recently.

I wrote a script (attached) for my own use which does the following:

o Check the image and device exist
o Check the device is writable
o Compare the device to a blacklist and abort if it&apos;s listed
o Display useful identifying information about the image and device
o Prompt the user before commencing the write

The output looks something like this:

dvhart@rage:/build/poky/fri2
$ sudo ~/bin/ddimage tmp/deploy/images/core-image-sato-fri2-noemgd.hddimg /dev/sdk
Image details
=============
    image: `tmp/deploy/images/core-image-sato-fri2-noemgd.hddimg&apos; -&gt; `core-image-sato-fri2-noemgd-20111202214038.hddimg&apos;
     size: 318568448 bytes
 modified: 2011-12-02 13:45:05.298897861 -0800
     type: x86 boot sector, code offset 0x58, OEM-ID &quot;SYSLINUX&quot;, sectors/cluster 16, root entries 512, Media descriptor 0xf8, sectors/FAT 152, heads 64, hidden sectors 32, sectors 622204 (volumes &gt; 32 MB) , serial number 0x4ed946e0, label: &quot;boot       &quot;, FAT (16 bit)

Device details
==============
  device: /dev/sdk
  vendor: Kingston
   model: DT 101 G2

Write tmp/deploy/images/core-image-sato-fri2-noemgd.hddimg to /dev/sdk [y/N]? y
Writing image...
303+1 records in
303+1 records out
318568448 bytes (319 MB) copied, 53.6766 s, 5.9 MB/s


Joshua and Kishore offered some initial feedback, including adding a feature where the script would present a list of available installation devices and allow the user to select from the list if they didn&apos;t provide a device as an argument. Joshua pointed me to https://github.com/abock/image-usb-stick which could provide a decent base for a more elaborate form of the tool.

Please share your thoughts about whether or not such a tool would be useful and what you would like to see it do. I&apos;d want to ensure that it does at least all of the above and remains usable from the command line (but that doesn&apos;t preclude it from having a GUI).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17479</commentid>
    <comment_count>1</comment_count>
      <attachid>285</attachid>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2011-12-02 15:05:37 +0000</bug_when>
    <thetext>Created attachment 285
Darren&apos;s prototype script</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18240</commentid>
    <comment_count>2</comment_count>
    <who name="Dexuan Cui">dexuan.cui</who>
    <bug_when>2012-01-18 17:41:57 +0000</bug_when>
    <thetext>*** Bug 1737 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18978</commentid>
    <comment_count>3</comment_count>
    <who name="Dexuan Cui">dexuan.cui</who>
    <bug_when>2012-03-13 06:28:40 +0000</bug_when>
    <thetext>Since we&apos;re creating GUI deploy tool(bug 1738), I think we don&apos;t need to supply an extra command line tool.
Hi Saul, Song and all, if you agree, can we close the bug, or make a duplicate of bug 1738?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19010</commentid>
    <comment_count>4</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2012-03-13 16:23:29 +0000</bug_when>
    <thetext>A GUI tool is not a replacement for a cmdline tool. If the GUI tool you are creating cannot be run from the cmdline in an automated way, then we still need a cmdline tool.

Several people build on headless build systems and the GUI adds an unnecessary overhead running the graphics over the network (and libraries that must be installed, etc.). It also doesn&apos;t work for people who prefer to script various tasks which may include writing the image.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19012</commentid>
    <comment_count>5</comment_count>
    <who name="Dexuan Cui">dexuan.cui</who>
    <bug_when>2012-03-13 16:38:41 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; A GUI tool is not a replacement for a cmdline tool. If the GUI tool you are
&gt; creating cannot be run from the cmdline in an automated way, then we still need
&gt; a cmdline tool.
The GUI tool is being integrated as part of the HOB, so it can&apos;t run alone from cmdline.

&gt; Several people build on headless build systems and the GUI adds an unnecessary
&gt; overhead running the graphics over the network (and libraries that must be
&gt; installed, etc.). It also doesn&apos;t work for people who prefer to script various
&gt; tasks which may include writing the image.
Hi Darren, 
Could you please send your patch to oe-core mailing list? And, can I assign this bug to you? :-) 
I think your patch is good enough to be in poky master.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19019</commentid>
    <comment_count>6</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2012-03-13 19:17:43 +0000</bug_when>
    <thetext>Patch on yocto mailing list adding ddimage to poky/scripts/contrib</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19114</commentid>
    <comment_count>7</comment_count>
    <who name="Dexuan Cui">dexuan.cui</who>
    <bug_when>2012-03-14 23:43:31 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Patch on yocto mailing list adding ddimage to poky/scripts/contrib

Darren, thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>19856</commentid>
    <comment_count>8</comment_count>
    <who name="Jiajun Xu">jiajun.xu</who>
    <bug_when>2012-04-04 13:48:57 +0000</bug_when>
    <thetext>QA tested the tool in 1.2 M4 RC1 testing, it could work well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>20073</commentid>
    <comment_count>9</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2012-04-09 17:00:40 +0000</bug_when>
    <thetext>In poky master:

commit af193ae15a2ad2e170d4a9d4bcbfff3e429784f5
Author: Darren Hart &lt;dvhart@linux.intel.com&gt;
Date:   Tue Mar 13 12:02:51 2012 -0700

    ddimage: Add script for writing images to boot media</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>285</attachid>
            <date>2011-12-02 15:05:37 +0000</date>
            <delta_ts>2011-12-02 15:05:37 +0000</delta_ts>
            <desc>Darren&apos;s prototype script</desc>
            <filename>ddimage</filename>
            <type>text/plain</type>
            <size>1595</size>
            <attacher name="Darren Hart">dvhart</attacher>
            
              <data encoding="base64">IyEvYmluL3NoCgojQkxBQ0tMSVNUX0RFVklDRVM9Ii9kZXYvc2RhIC9kZXYvc2RiIC9kZXYvc2Rj
IC9kZXYvc2RkIC9kZXYvc2RlIgpCTEFDS0xJU1RfREVWSUNFUz0iL2Rldi9zZGEiC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