summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/ddimage
Commit message (Collapse)AuthorAgeFilesLines
* scripts/contrib/ddimage: be explicit whether device doesn't exist or isn't ↵Paul Eggleton2019-07-031-2/+7
| | | | | | | | | | | writeable Make the error messages a little more friendly. (From OE-Core rev: 36f308b0134c69b439152c2473a274d96b0fee89) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/contrib/ddimage: replace blacklist with mount checkPaul Eggleton2019-07-031-13/+67
| | | | | | | | | | | | | | | | | | The blacklist, whilst previously useful for safety, is now becoming obsolete - on my current system, the main storage is at /dev/nvme* and if I plug in a USB stick it shows up as /dev/sdb which was previously blacklisted. To make this more flexible, remove the blacklist and instead check if the specified device is mounted, has a partition that is mounted, or is otherwise in use according to the kernel, and show an appropriate error and quit if so. To make this robust, also ensure we handle where the specified device is a symlink to another device. (From OE-Core rev: 49043de1a7716ad612fb92a2e8a52e43d253c800) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/contrib/ddimage: fix typoPaul Eggleton2019-07-031-1/+1
| | | | | | | | | UNKOWN -> UNKNOWN (From OE-Core rev: adf632c959e7f6595b697726fe64ddda40b9f249) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* meta/lib+scripts: Convert to SPDX license headersRichard Purdie2019-05-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. (From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* ddimage: if 'pv' is installed, use itChristopher Larson2016-05-061-1/+5
| | | | | | | | | | | This gives us a progress bar for the image write, which is quite helpful. See https://www.ivarch.com/programs/pv.shtml. (From OE-Core rev: 5b20cb2db929daaf0bf81c05368174e9c364ffab) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* ddimage: Support Mac OSDarren Hart2014-05-281-5/+20
| | | | | | | | | | | | | | Update the ddimage script to allow it to work on Mac OS too. The biggest difference is sysfs vs diskutil and in the syntax of the stat command between Mac OS and Linux, unfortunately. Workarounds using ls, cut, and columns got really fragile really quickly. Relying on stat and switching on uname seemed the more robust solution. (From OE-Core rev: 8962fe11a0697348affb8a1ab95abca4995470a6) Signed-off-by: Darren Hart <dvhart@linux.intel.com> Cc: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/contrib/*: fix arithmetic bashismPaul Eggleton2013-07-181-1/+1
| | | | | | | | | | | Apparently $[...] isn't valid in dash, so use $((...)) instead for mkefidisk.sh and ddimage that both start with $!/bin/sh. (From OE-Core rev: d509739ca54e6b70f2dcc216b831fc02c64293a6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* ddimage: fix incompatibility with dashHongxu Jia2013-06-111-7/+9
| | | | | | | | | | | | | On systems with dash as /bin/sh there were failures while invoking ddimage. Fix to let it work with both bash and dash shells. [YOCTO #4617] (From OE-Core rev: 4c6f7a5d8bd6ada434b91037ecd5db06f3eac814) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Replace "echo -e" with "printf" to have the same behavior in dash or bashAndrei Gherzan2012-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | oe-core removed the prerequisite to have sh as bash. POSIX doesn't define any options and furthermore allows 'echo -e' to be the default behavior. This means that in dash 'echo -e' will actually print '-e' and interpret backslashes by default. We use instead 'printf' builtin command with or without '\n' to simulate 'echo -e' or 'echo -n'. 'printf' needs format while 'echo' can be used without any arguments. So 'echo >' was replaced by 'printf "" >'. 'echo' without '-n' flag adds a new line by default so to keep the same behavior of two new lines while using 'echo "\n"', 'printf "\n\n"' is used. [YOCTO #3138] (From OE-Core rev: a19880ad10ccb5d7d909dcf9de5c3dc58a0ebcd3) Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* ddimage: Add script for writing images to boot mediaDarren Hart2012-03-221-0/+87
Fixes [YOCTO #1806] Standard practice is to use the Linux "dd" 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. The ddimage script 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's listed Blacklist defaults to "/dev/sda" o Display useful identifying information about the image and device o Prompt the user before commencing the write The output looks something like this: $ 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' -> `core-image-sato-fri2-noemgd-20111202214038.hddimg' size: 318568448 bytes modified: 2011-12-02 13:45:05.298897861 -0800 type: x86 boot sector, code offset 0x58, OEM-ID "SYSLINUX", sectors/cluster 16, root entries 512, Media descriptor 0xf8, sectors/FAT 152, heads 64, hidden sectors 32, sectors 622204 (volumes > 32 MB) , serial number 0x4ed946e0, label: "boot ", 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 (From OE-Core rev: 87e581bb7da9f1530d190cd023fcf892c8b858f5) Signed-off-by: Darren Hart <dvhart@linux.intel.com> CC: Dexuan Cui <dexuan.cui@intel.com> CC: Joshua Lock <josh@linux.intel.com> CC: Kishore K Bodke <kishore.k.bodke@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>