Linux tools for manipulating image files and writing or reading to and from flash-memory e.g. SD-cards
- Suitable for preparing image-files for raspberry pi, beagle-bone and so on...
- Thru automatically querying a permission-file in /etc/dev_permissions.conf no inadvertent faulty input which can damage the system (like by dd) 💣 becomes possible.
- Using a progress-bar for writing and/or reading.
Build-in help: iwrite -h
Image-WriterVersion: 1.4
(C) 2014www.INKATRON.deAuthor: UlrichBeckerUsage: iwrite [options] [Source-Image-file] [TargetBlock-Device]
iwrite<-z | --zero> [options] [TargetBlock-Device]
Ifthefirstparameternotgivenandoption-xor-disactive,
afile-menuwillappear.
IfthelastParameter (TargetBlock-Device) notgivenandoption-xor-disactive,
thetarget-block-devicewillbesearchautomatically.
Ifmorethenonefoundofthem, adialog-boxwillappearwithallfoundconnecteddevicestoselect.
Block-devicesarecheckedin"/etc/dev_permissions.conf"Options:
-h, --helpThishelpandexit-vVerbose-s, --silenceSilence"dd"isusedonly-d, --dialogRunprogramindialog-boxes-x, --xdialogRunprograminX11dialog-boxes. Xdialogmustbeinstalled.
-lListallpermittedblock-devicesof"/etc/dev_permissions.conf"-cListallconnectedpermittedblock-devicesof"/etc/dev_permissions.conf"-e, --entireCopytheentirefile-sizeandnottilltotheendofthehighestpartitiononly.
-nNocopy (simulateonly)
-Y, --yesAnswerssafetyquestionswith"yes".
-z, --zeroClearthecontentofentiretargetdeviceby /dev/zero-L=<RATE>Limitthetransferof"pv"toamaximumofRATEbytespersecond.
Asuffixof"k", "m", "g", or"t"canbeaddedtodenotekilobytes (*1024),
megabytes, andsoon. Thedefaultis5m--versionPrintversionandexit.xsudo iwrite -x /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img /dev/sde
Counterpart of the image-writer iwrite.
Build-in help: iwrite -h
Image-reader
(C) 2014www.INKATRON.deAuthor: UlrichBeckerUsage: iread [options] [Target-Image-file] [SourceBlock-Device]"
IfthelastParameter (SourceBlock-Device) notgivenandoption-xor-disactive,
thesource-block-devicewillbesearchautomatically.
Ifmorethenonefoundofthem, adialogboxwillappearwithallfoundconnecteddevicestoselect.
Block-devicesarecheckedin"/etc/dev_permissions.conf"Options:
-h, --helpThishelp-vVerbose-s, --silenceSilence"dd"isusedonly-d, --dialogShowprogress-barinadialog-x, --xdialogRunprograminX11dialog-boxes. Xdialogmustbeinstalled.
-lListallpermittedblock-devicesof"/etc/dev_permissions.conf"-cListallconnectedpermittedblock-devicesof"/etc/dev_permissions.conf"-e, --entireCopytheentireblock-deviceandnottilltotheendofthehighestpartitiononly.
-nNocopy (simulateonly)
-Y, --yesAnswerssafetyquestionswith"yes".
-L=<RATE>Limitthetransferof"pv"toamaximumofRATEbytespersecond.
Asuffixof"k", "m", "g", or"t"canbeaddedtodenotekilobytes (*1024),
megabytes, andsoon. Thedefaultis5m--versionPrintversionandexit.The image-mounter mounts or un-mounts all included mountable partitions of a image-file. This program is mandatory for using "cross-chroot".
Build-in help: imount -h
Imagefile-MounterandUnmounterimount: (C) 2014www.INKATRON.deAuthor: UlrichBeckerVersion: 1.15Usage: imount [-options] <imagefileorblock-device> [mountpoint]
If [mountpoint] notgiven, thedefault"/mnt"willbeused.
Options:
-h, --helpThishelp.
-uUnmount.
-UUnmountandremovemount-point-directoriesifpossible.
-nDonotmount (simulateonly).
-vVerbose.
-iGetmount-infosif<image-fileorblock-device>mounted.
-lListallpermittedblock-devices.
-lListofpermittedblock-devices.
-LListnumbersoffoundpartitionsof<imagefileorblock-device>andmount-pointsifcorrespondingpartitionmountedby"imount".
-EShowextendedpartitionsbyoption-L.
-SShowswappartitionbyoption-L.
-NNoprefix (+path+to+imagefile+) forthepartition-mountpoints.
-sGetsubstitutecharacterofpath-separator.
-pDisplaybase-mount-pointof<image-file>ifmounted.
-P=<","separatedlistofpartition-numberstoprocess>Partition-numberstoprocesswillbeindicatedbyoption"-L".
Ifthisoptionnotgiven, allfoundmountablepartitionswillmount (orunmountbyoption"-U"or"-u").
--versionVersion-numbersudo imount -v /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img
INFO: Creatingdirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1".
INFO: Mountpartitionof: "2016-09-23-raspbian-jessie.img"to"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1"atoffset: 4194304size: 66060288INFO: Creatingdirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2".
INFO: Mountpartitionof: "2016-09-23-raspbian-jessie.img"to"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"atoffset: 70254592size: 4278190080sudo imount -vU /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img
INFO: Unmountpartition: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1"byoption: "".
INFO: Removedirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1"INFO: Unmountpartition: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"byoption: "".
INFO: Removedirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"By this tool it becomes possible to simulate for example a raspberry pi or similar devices on the PC with the appropriate image-file.
Build-in help: cross-chroot -h
cross-chroot: (C) 2014www.INKATRON.deAuthor: UlrichBeckerVersion: 0.20Usage: cross-chroot [OPTION] <target-root> [COMMAND [ARG]...]
<target-root>canbeapath, aimage-fileorablock-deviceIfnocommandisgiven, run"/bin/bash -i" (default: "/bin/sh -i").
Block-devicesarecheckedin"/etc/dev_permissions.conf"Options:
-h, --helpThishelp-vVerbose-lListpermittedblock-devices-fTrytomountitemsof<target-root>/etc/fstabiffound.
-mMount"/dev:/dev/pts:/dev/shm:/proc:/sys"totarget-root-m=<mount1[:mount2[...:mountX]]>Explicitmount-list.
-m+<mount1[:mount2[...:mountX]]>Additionalexplicitmount-listtothedefault"/dev:/dev/pts:/dev/shm:/proc:/sys".
-p=<mountpoint>Mountpointforimage-filesorblock-devicesdefaultis: "/mnt".
--enter=<enter-program>--leave=<leave-program>--versionVersion-numberExample 1:
sudo cross-chroot -vmf /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img
INFO: Checkingwhetherainstanceofthisprogrambythesameimageisalreadyrunning...
INFO: Creatingdirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1".
INFO: Mountpartitionof: "/hdd/v1/FLASH/2016-09-23-raspbian-jessie.img"to"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1"atoffset: 4194304size: 66060288INFO: Creatingdirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2".
INFO: Mountpartitionof: "/hdd/v1/FLASH/2016-09-23-raspbian-jessie.img"to"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"atoffset: 70254592size: 4278190080INFO: Foundroot-partition"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"of"/hdd/v1/FLASH/2016-09-23-raspbian-jessie.img".
INFO: Readingfilesystem-tablein: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/fstab"INFO: Reading3linesof "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/fstab".INFO: Mountitemof "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/fstab" --> "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/boot"
INFO: CPUforroot-directoty"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"is"arm".
INFO: Emulatoris: "qemu-arm".INFO: Emulator "/usr/bin/qemu-arm" already registered.INFO: Mount "/dev" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/dev".INFO: Mount "/dev/pts" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/dev/pts".INFO: Mount "/dev/shm" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/dev/shm".INFO: Mount "/proc" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/proc".INFO: Mount "/sys" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/sys".INFO: Disabele "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/ld.so.preload" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/ld.so.preload.disabled".
INFO: Copy "/usr/bin/qemu-arm" to "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/usr/bin/qemu-arm"
INFO: Enteringinchroot"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"foremulatingCPU"arm".
INFO: PID=32287***************************Type"exit"toleave. ***************************root@linux-42bj:/# uname-aLinuxlinux-42bj4.6.2-3.g2a68ef0-default#1 SMP PREEMPT Fri Jun 10 08:12:44 UTC 2016 (2a68ef0) armv7l GNU/Linux
root@linux-42bj:/# exitexitINFO: Deletinghost-binary"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/usr/bin/qemu-arm"INFO: Reenable"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/ld.so.preload.disabled"to"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/etc/ld.so.preload".
INFO: Unmount"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/sys"byoption: "".
INFO: Unmount"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/proc"byoption: "".
INFO: Unmount"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/dev/shm"byoption: "".
INFO: Unmount"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/dev/pts"byoption: "".
INFO: Unmount"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/dev"byoption: "".
INFO: Unmount"/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2/boot"byoption: "".
INFO: Unmountpartition: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1"byoption: "".
INFO: Removedirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img1"INFO: Unmountpartition: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"byoption: "".
INFO: Removedirectory: "/mnt/+hdd+v1+FLASH+2016-09-23-raspbian-jessie.img2"Example 2: Executing the web-browser DILLO for ARM on the PC which is installed in the raspberry pi image.
xsudo cross-chroot -vmf /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img dillo
Example 3: Executing the raspberry pi configuration-script on the PC.
sudo cross-chroot -vmf /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img raspi-config
I-Parted is a wrapper-shell-script which makes it possible to manipulate partitions of a image-file.
Example:
iparted -h
Partition-Editorforimage-files
(C) 2014www.INKATRON.deAuthor: UlrichBeckerUsage: iparted [options] [Imagefile | Block-device] [Desiredentireimagefile-size | possibletargetblock-device]
Block-devicesarecheckedin"/etc/dev_permissions.conf"Options:
-h, --helpThishelp.
-vVerbose.
-s, --shrinkShrinkfilesizeoftheimagefiletotheborderofthehighestpartition.
-lListallpermittedblock-devicesof"/etc/dev_permissions.conf"-cListallconnectedpermittedblock-devicesof"/etc/dev_permissions.conf"--versionPrintversionandexit.xsudo iparted -v /hdd/v1/FLASH/2016-09-23-raspbian-jessie.img 8GiB
The central point of the I-Tools is the permission file dev_permissions.conf,
by default stored in the folder /etc/.
Without this file nothing will do!
The permission-file contains the items of all device-files which are allowed
for the access of I-Tools for writing or reading.
In this way there is no danger of mistyping a input which can damage your system
e.g.: accidentally input of /dev/sda. 💣
You can write this file by a simple text editor or it's also possible to generate
it automatically by the program mk-permit.
In the case of automatically generation follow the instructions of the program
mk-permit.sh.
CAUTION: If you have added or removed additional physical hard-disks on your
computer so you have to repeat this procedure after that immediately!
The example below shows the content of a automatically generated permission-file
by mk-permit.sh.
In this example the device-files /dev/sda and /dev/sdb are physical hard-disks
on the computer where the access of the I-Tools isn't permitted for safety
reasons. The device-files /dev/sdc, /dev/sdd, /dev/sde and /dev/sdf are
permitted for write and read accesses for the Image-File-Tools.
###############################################################################
## ##
## List of the permitted block-devices for the I-Tools ##
## ##
###############################################################################
# File: /etc/dev_permissions.conf
# Generated by: mk-permit.sh
# Date: Thu May 28 15:36:39 CEST 2015
###############################################################################
# For the I-Tools permitted block-devices:
/dev/sdc
/dev/sdd
/dev/sde
/dev/sdf
- Pipe viewer PV Version >= 2.3.1
URL: http://www.ivarch.com/programs/pv.shtml
Required for:iwrite.shandiread.sh - Xdialog
URL: http://xdialog.free.fr
Optional required foriwrite.shandiread.sh
Mandatory required foriparted.sh - chroot
URL: http://ftp.gnu.org/gnu/coreutils
Required for:cross-chroot.sh - CPU-Emulator qemu (the static linked version)
URL: http://wiki.qemu.org
Required forcross-chroot.sh - gparted (Gnome Partition Editor) Version >= 0.14.1
URL: http://gparted.org
Required foriparted.sh
- Download or make a clone from github:
git clone https://github.com/UlrichBecker/LinuxFlashUtilities.git
If you doesn't have installed git on your computer so you can also download the ZIP-file from the URL above. - Navigate to the sub-directory
cd ./src. - Type
sudo ./install.sh. - Create the permission-file
/etc/dev_permissions.conflike described above.
The following output shows the build-in help of install.sh -h:
ProgramtoinstalloruninstalltheINKATRON-I-Toolsinstall.sh: (C) 2014www.INKATRON.deAuthor: UlrichBeckerVersion: 0.1Usage: install.sh [-options]
Options:
-h, --helpThishelp-uUninstall-lListallprograms.
-t=<targetdirectory>Defaultis"/usr/local/bin"--versionPrintversion


