Samsung soc sd irom writer for Linux

Source: Internet
Author: User

It has been tested to run smoothly on fedora10 and requires root permission for execution.

#! /Bin/bash <br/> # written by cpuwolf@gmail.com 2010 <br/> mountpt =/Media/disk <br/> devicename = SDB <br/> sdcard =/dev/$ devicename </P> <p> If test $ #-Le 0; then <br/> echo "error: needs irom image path "<br/> Exit 1 <br/> fi <br/> infile =" $1 "<br/> If [-e $ infile]; then <br/> echo "irom image: $ infile" <br/> else <br/> echo "irom image: $ infile does not existing "<br/> Exit 1 <br/> fi <br/> imagelen = 'wc-C <$ I Nfile' <br/> echo "irom image size: $ imagelen bytes" </P> <p> If [-E/sys/block/$ devicename/removable]; then <br/> removable = $ (CAT/sys/block/$ devicename/removable) <br/> else <br/> echo "SD card: /dev/$ devicename is not existing "<br/> Exit 1; <br/> fi <br/> If [! $ Removable = "1"]; then <br/> echo "/dev/$ devicename is not removable" <br/> Exit 1; <br/> fi <br/> If [-E/sys/block/$ devicename/queue/hw_sector_size]; then <br/> sectorsize = $ (CAT/sys/block/$ devicename/queue/hw_sector_size) <br/> echo "SD card sector size: $ sectorsize bytes "<br/> If! Test $ sectorsize-EQ 512; then <br/> echo "Warning: sector size is not 512 "<br/> fi <br/> If [-E/sys/block/$ devicename/size]; then <br/> numsectors = $ (CAT/sys/block/$ devicename/size) <br/> echo "SD card total size: $ numsectors sectors "<br/> fi <br/> disksize = 'expr $ numsectors/* $ sectorsize' <br/> echo" SD card total size: $ disksize bytes "<br/> reservedsize = 'expr $ sectorsize/* 2' <br/> ends Ize = 'expr $ reservedsize + $ imagelen' <br/> diskoffset = 'expr $ disksize-$ endsize' <br/> echo "irom image is writen to offset: $ diskoffset (bytes) "<br/> diskoffsetsector = 'expr $ diskoffset/$ sectorsize' <br/> echo" irom image is writen to offset: $ diskoffsetsector (sectors) "<br/> issectoralign = 'expr $ diskoffset % $ sectorsize' <br/> If! Test $ issectoralign-EQ 0; then <br/> echo "Warning: irom image size is not align on sectors "<br/> fi <br/> echo" start flushing irom image... "<br/> dd If = $ infile of =/dev/$ devicename BS = $ sectorsize seek = $ diskoffsetsector>/dev/null 2> & 1 & Echo" Flush successful "| echo" error: flush "<br/> 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.