LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2012, 04:13 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,485

Rep: Reputation: 51
Writing all ones to a device.


Kernel 2.6.21.5, Slackware 12.0

Hi:
To make an SD card look blank to the card reader, I intend to write all binary ones to it using dd. For example,
Code:
source_of_ones | dd bs=1M of=/dev/sda
Is there a linux command that can feed ones to dd input? The reason for blanking the card is that an image must be written on a blank card and then a certain device will boot from the card. The requirement of a blank card can be due to the fact that "The System will expand the root filesystem to fill the SD card on first boot".
 
Old 02-17-2012, 04:19 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
I don't see why it needs to be ones, why not use /dev/null or /dev/urandom? I expect you could run "yes 1" to get what you want, but make sure you don't run is without it being piped into anything else or you'll never stop it! Also - "while [ 1 ]; do echo -n 1; done"
 
Old 02-17-2012, 04:20 AM   #3
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,613

Rep: Reputation: 433Reputation: 433Reputation: 433Reputation: 433Reputation: 433
To blank the card is to write it with zeros:

Quote:
dd if=/dev/zero of=/dev/usb
it defaults to block size of 1024 unless you specify another. You can repeat procedure as many times you want to write zeros into the drive.

BTW /dev/null is okay.

Hope that helps.
 
Old 02-17-2012, 04:25 AM   #4
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,485

Original Poster
Rep: Reputation: 51
I presume it is either all ones or all zeroes. Do not know exactly if ones or zeroes. I also suppose from /dev/null I get zeroes. Thanks.
 
Old 02-17-2012, 04:27 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
Quote:
Originally Posted by stf92 View Post
I presume it is either all ones or all zeroes. Do not know exactly if ones or zeroes. I also suppose from /dev/null I get zeroes. Thanks.
Nooo. null != zero
 
Old 02-17-2012, 04:30 AM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,485

Original Poster
Rep: Reputation: 51
Thank you guys.
 
Old 02-17-2012, 05:39 AM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 14,837

Rep: Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820Reputation: 1820
Quote:
Originally Posted by acid_kewpie View Post
Nooo. null != zero
And a null terminated string is terminated with .... ???.

... sorry, couldn't resist the bait.
 
Old 02-17-2012, 08:40 AM   #8
Samotnik
Member
 
Registered: Jun 2006
Location: Belarus
Distribution: Debian GNU/Linux testing/unstable
Posts: 471

Rep: Reputation: 40
And a null terminated string is terminated with ... yes. BUT. /dev/null returns ... not. Because it returns EOF. Which is 0xFF. Which is ... ??? ;-)
 
Old 02-17-2012, 09:02 AM   #9
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,485

Original Poster
Rep: Reputation: 51
This thread is a learning experience!
 
Old 02-17-2012, 09:40 AM   #10
uhelp
Member
 
Registered: Nov 2011
Location: Germany, Bavaria, Nueremberg area
Distribution: openSUSE, Debian, LFS
Posts: 205

Rep: Reputation: 43
Why bothering about zero nada nothing?
use "wipe"
 
Old 02-17-2012, 11:33 AM   #11
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,485

Original Poster
Rep: Reputation: 51
Thanks for the data. And for the finesse (nada). However, using dd is fun.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in writing device driver rainbow82 Linux - Embedded & Single-board computer 2 08-02-2011 03:42 PM
device drivers writing ashagottipati Programming 2 06-01-2007 08:57 PM
Writing Device Drivers... worldgnat Linux - Hardware 26 12-26-2006 09:01 PM
writing device drivers jessy jane Linux - Newbie 2 11-04-2004 01:25 AM
writing device dummyagain Programming 2 10-18-2003 05:50 AM


All times are GMT -5. The time now is 06:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration